From owner-svn-src-all@FreeBSD.ORG Mon Apr 18 19:48:06 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 7AB201065678; Mon, 18 Apr 2011 19:48:06 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.garage.freebsd.pl (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 1DA458FC17; Mon, 18 Apr 2011 19:48:05 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 19F5245EA7; Mon, 18 Apr 2011 21:48:04 +0200 (CEST) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id 86BCA45EAA; Mon, 18 Apr 2011 21:47:58 +0200 (CEST) Date: Mon, 18 Apr 2011 21:47:50 +0200 From: Pawel Jakub Dawidek To: Kostik Belousov Message-ID: <20110418194750.GD3097@garage.freebsd.pl> References: <201104181632.p3IGWM5v077720@svn.freebsd.org> <20110418192810.GX48734@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="OaZoDhBhXzo6bW1J" Content-Disposition: inline In-Reply-To: <20110418192810.GX48734@deviant.kiev.zoral.com.ua> X-OS: FreeBSD 9.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-0.6 required=4.5 tests=BAYES_00,RCVD_IN_SORBS_DUL autolearn=no version=3.0.4 Cc: svn-src-head@freebsd.org, Matthew D Fleming , svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r220791 - in head: lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys 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: Mon, 18 Apr 2011 19:48:06 -0000 --OaZoDhBhXzo6bW1J Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Apr 18, 2011 at 10:28:10PM +0300, Kostik Belousov wrote: > > + if (offset + len > vap->va_size) { > > + VATTR_NULL(vap); > > + vap->va_size =3D offset + len; > > + error =3D VOP_SETATTR(vp, vap, td->td_ucred); > > + if (error !=3D 0) > > + goto out; > > + } > I still do not see a reason to do VOP_SETATTR() there. VOP_WRITE() will > do auto-extend as needed. Also, see below. Yeah, also when we extend file size we could skip reading zeros. > > + if (offset < vap->va_size) { [...] > > + } else { > > + bzero(buf, cur); > > + } > Wouldn't VOP_SETATTR() at the start of the function mostly prevent > this bzero from executing ? Once we drop the vnode lock, the file size can change under us, no? > I estimated what it would take to do the optimized implementation for UFS, > and I think that the following change would allow to lessen the code > duplication much. >=20 > What if the vnode lock drop and looping be handled by the syscall, instead > of the vop implementation ? In other words, allow the VOP_ALLOCATE() > to allocate less then requested, and return the allocated amount to > the caller. The loop would be centralized then, freeing fs from doing > the dance. Also, if fs considers that suitable, it would do a whole > allocation in one run. I'd still go with SEEK_DATA/SEEK_HOLE loop as I suggested on arch@. If you would like to spend time on it, having SEEK_DATA/SEEK_HOLE support in UFS would be beneficial for other purposes too. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://yomoli.com --OaZoDhBhXzo6bW1J Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAk2slWUACgkQForvXbEpPzQOEgCg15ceghLKdon8khGcub0z2pwg 3n8AnipfpoOnf6hpQ3nut1gvoRT/W+F6 =69mP -----END PGP SIGNATURE----- --OaZoDhBhXzo6bW1J--