From owner-freebsd-scsi@FreeBSD.ORG Tue Oct 26 05:22:14 2010 Return-Path: Delivered-To: freebsd-scsi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B26E106564A for ; Tue, 26 Oct 2010 05:22:14 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57]) by mx1.freebsd.org (Postfix) with ESMTP id CBDF08FC13 for ; Tue, 26 Oct 2010 05:22:13 +0000 (UTC) Received: from [127.0.0.1] (pooker.samsco.org [168.103.85.57]) (authenticated bits=0) by pooker.samsco.org (8.14.4/8.14.4) with ESMTP id o9Q5M9k4007968; Mon, 25 Oct 2010 23:22:09 -0600 (MDT) (envelope-from scottl@samsco.org) Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: text/plain; charset=us-ascii From: Scott Long In-Reply-To: <649630C24D5E884F85DD13645FE903A7640B244F@wtl-exch-2.sandvine.com> Date: Mon, 25 Oct 2010 23:22:09 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: References: <649630C24D5E884F85DD13645FE903A7640B244F@wtl-exch-2.sandvine.com> To: Mark Johnston X-Mailer: Apple Mail (2.1081) X-Spam-Status: No, score=-50.0 required=3.8 tests=ALL_TRUSTED, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.0 X-Spam-Checker-Version: SpamAssassin 3.3.0 (2010-01-18) on pooker.samsco.org Cc: "freebsd-scsi@freebsd.org" Subject: Re: [Patch] camcontrol - determine the defect list length X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 05:22:14 -0000 On Oct 25, 2010, at 9:55 AM, Mark Johnston wrote: > Hi, >=20 > Below is a patch for camcontrol from the tree at my work. It was = introduced several years ago to resolve some issues that we were seeing = in Adaptec's RAID controller firmware. The change is to the = readdefects() function - when sending the request to read the defect = list, instead of using a 65000-entry buffer, we wrote a new function to = query the drive and determine the size of the defect list before = allocating any memory. Apparently, if we send a maximum length longer = than the number of bytes in the defect list, the cam call returns an = overflow error due to what is probably a firmware bug. >=20 > It's probable that this issue has been fixed in Adaptec's firmware for = a while now, and that this change is no longer necessary to us. However, = it's conceivable that other devices could have the same problem, and as = far as I can see, this patch shouldn't introduce any regressions - it = essentially consists of sending an additional CAM request before getting = the defect list. >=20 > I'd like to know whether this patch is worth trying to get committed = into FreeBSD. If anyone has some comments or suggestions on the patch, = I'd highly appreciate it. >=20 Should the whole operation of reading the defect list abort if = readdefectlen() fails, or should it just fall back to a modest length = and try the operation anyways? Also, if readdefectlen() succeeds, how = do the defect_list and ccb get freed? Scott