From owner-svn-src-all@FreeBSD.ORG Thu Apr 14 20:10:32 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 653F91065674; Thu, 14 Apr 2011 20:10:32 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com [209.85.161.54]) by mx1.freebsd.org (Postfix) with ESMTP id 24AFC8FC21; Thu, 14 Apr 2011 20:10:30 +0000 (UTC) Received: by fxm11 with SMTP id 11so1945710fxm.13 for ; Thu, 14 Apr 2011 13:10:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:message-id:date:from:user-agent :mime-version:to:cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=y1bSUjHm0AC4clPcEOSmIp2RqmSdUjuHCBtlEzgqGLc=; b=szR3v/0/FRru4j9pavDNjeJrfreNZraCSJDq390dmOrZwodRj4tG46YF86RAhhzvD4 vCmuebbY/bI+d1BuJQbN/zZtOHg2U34QPbnvLdMzT3urPN5ANk3LX0AURmhDLqvyzfML Agfls1PMUCWRXyCpFQ7fest7N7/t904PquQcU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=AaAbnYuSin+llMHePh9SD398zV+z0BRjuBAyLnErK11xyu1IIao86NMYgF3xrVwtJu 8uYnvdC4OtHNVAiKLwVlygUgbvHBwW6u+OtihD4j3xnA9YBNd159+i+4TAakRfQBdHTI wi95EDescezM0hQtN4PNmlpzcnUdbpwEwWepQ= Received: by 10.223.35.147 with SMTP id p19mr1297424fad.13.1302811830033; Thu, 14 Apr 2011 13:10:30 -0700 (PDT) Received: from mavbook.mavhome.dp.ua (pc.mavhome.dp.ua [212.86.226.226]) by mx.google.com with ESMTPS id o17sm599988fal.25.2011.04.14.13.10.28 (version=SSLv3 cipher=OTHER); Thu, 14 Apr 2011 13:10:29 -0700 (PDT) Sender: Alexander Motin Message-ID: <4DA754B2.6070802@FreeBSD.org> Date: Thu, 14 Apr 2011 23:10:26 +0300 From: Alexander Motin User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.15) Gecko/20110310 Thunderbird/3.1.9 MIME-Version: 1.0 To: Jaakko Heinonen References: <201104140911.p3E9BooX027074@svn.freebsd.org> <20110414160059.GA1644@a91-153-123-205.elisa-laajakaista.fi> In-Reply-To: <20110414160059.GA1644@a91-153-123-205.elisa-laajakaista.fi> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r220618 - head/sys/cam/ata X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Apr 2011 20:10:32 -0000 On 14.04.2011 19:00, Jaakko Heinonen wrote: > On 2011-04-14, Alexander Motin wrote: >> Fix typo in write_cache tunable name and move TUNABLE_INT_FETCH() out of >> the SIM lock to fix WITNESS warning. > > Thanks! > > Does this analogous patch for cd(4) and da(4) look good? Looks fine. > I am not > completely sure if it's safe to move setting of minimum_cmd_size in > daregister(). I see no problem. dastart() in NORMAL state, that using it, won't be called until device created (to be opened) and hold will not be dropped. > --- > > Move TUNABLE_INT_FETCH() out of the SIM lock to avoid sleeping while > holding the lock. The fix is analogous to r220618 for ada(4). > > %%% > Index: sys/cam/scsi/scsi_cd.c > =================================================================== > --- sys/cam/scsi/scsi_cd.c (revision 220619) > +++ sys/cam/scsi/scsi_cd.c (working copy) > @@ -687,6 +687,8 @@ cdregister(struct cam_periph *periph, vo > else > softc->minimum_command_size = 6; > > + (void)cam_periph_hold(periph, PRIBIO); > + cam_periph_unlock(periph); > /* > * Load the user's default, if any. > */ > @@ -712,7 +714,6 @@ cdregister(struct cam_periph *periph, vo > * WORM peripheral driver. WORM drives will also have the WORM > * driver attached to them. > */ > - cam_periph_unlock(periph); > softc->disk = disk_alloc(); > softc->disk->d_devstat = devstat_new_entry("cd", > periph->unit_number, 0, > @@ -745,6 +746,7 @@ cdregister(struct cam_periph *periph, vo > softc->disk->d_hba_subdevice = cpi.hba_subdevice; > disk_create(softc->disk, DISK_VERSION); > cam_periph_lock(periph); > + cam_periph_unhold(periph); > > /* > * Add an async callback so that we get > Index: sys/cam/scsi/scsi_da.c > =================================================================== > --- sys/cam/scsi/scsi_da.c (revision 220619) > +++ sys/cam/scsi/scsi_da.c (working copy) > @@ -1231,35 +1231,6 @@ daregister(struct cam_periph *periph, vo > TASK_INIT(&softc->sysctl_task, 0, dasysctlinit, periph); > > /* > - * RBC devices don't have to support READ(6), only READ(10). > - */ > - if (softc->quirks& DA_Q_NO_6_BYTE || SID_TYPE(&cgd->inq_data) == T_RBC) > - softc->minimum_cmd_size = 10; > - else > - softc->minimum_cmd_size = 6; > - > - /* > - * Load the user's default, if any. > - */ > - snprintf(tmpstr, sizeof(tmpstr), "kern.cam.da.%d.minimum_cmd_size", > - periph->unit_number); > - TUNABLE_INT_FETCH(tmpstr,&softc->minimum_cmd_size); > - > - /* > - * 6, 10, 12 and 16 are the currently permissible values. > - */ > - if (softc->minimum_cmd_size< 6) > - softc->minimum_cmd_size = 6; > - else if ((softc->minimum_cmd_size> 6) > - && (softc->minimum_cmd_size<= 10)) > - softc->minimum_cmd_size = 10; > - else if ((softc->minimum_cmd_size> 10) > - && (softc->minimum_cmd_size<= 12)) > - softc->minimum_cmd_size = 12; > - else if (softc->minimum_cmd_size> 12) > - softc->minimum_cmd_size = 16; > - > - /* > * Register this media as a disk > */ > > @@ -1291,6 +1262,35 @@ daregister(struct cam_periph *periph, vo > dasendorderedtag, softc); > > mtx_unlock(periph->sim->mtx); > + /* > + * RBC devices don't have to support READ(6), only READ(10). > + */ > + if (softc->quirks& DA_Q_NO_6_BYTE || SID_TYPE(&cgd->inq_data) == T_RBC) > + softc->minimum_cmd_size = 10; > + else > + softc->minimum_cmd_size = 6; > + > + /* > + * Load the user's default, if any. > + */ > + snprintf(tmpstr, sizeof(tmpstr), "kern.cam.da.%d.minimum_cmd_size", > + periph->unit_number); > + TUNABLE_INT_FETCH(tmpstr,&softc->minimum_cmd_size); > + > + /* > + * 6, 10, 12 and 16 are the currently permissible values. > + */ > + if (softc->minimum_cmd_size< 6) > + softc->minimum_cmd_size = 6; > + else if ((softc->minimum_cmd_size> 6) > + && (softc->minimum_cmd_size<= 10)) > + softc->minimum_cmd_size = 10; > + else if ((softc->minimum_cmd_size> 10) > + && (softc->minimum_cmd_size<= 12)) > + softc->minimum_cmd_size = 12; > + else if (softc->minimum_cmd_size> 12) > + softc->minimum_cmd_size = 16; > + > softc->disk = disk_alloc(); > softc->disk->d_open = daopen; > softc->disk->d_close = daclose; > %%% > -- Alexander Motin