RFC: NFS client patch to reduce sychronous writes

Rick Macklem rmacklem at uoguelph.ca
Sat Nov 30 22:57:08 UTC 2013


Kostik wrote:
> On Thu, Nov 28, 2013 at 06:50:20PM -0500, Rick Macklem wrote:
> > 			obcount = np->n_size - (lbn * biosize);
> > *** This sets obcount to the byte offset within the buffer cache
> > block of
> >     EOF before it is grown by this write (or file size mod biosize,
> >     if you prefer)
> > 			bp = nfs_getcacheblk(vp, lbn, obcount, td);
> > 
> > 			if (bp != NULL) {
> > 				long save;
> > 
> > 				mtx_lock(&np->n_mtx);
> >   				np->n_size = uio->uio_offset + n;
> > 				np->n_flag |= NMODIFIED;
> > 				vnode_pager_setsize(vp, np->n_size);
> > *** n_size is now grown to the new EOF for after the write.
> > 				mtx_unlock(&np->n_mtx);
> > 
> > 				save = bp->b_flags & B_CACHE;
> > 				bcount = on + n;
> > 				allocbuf(bp, bcount);
> > 				bp->b_flags |= save;
> > 				if (noncontig_write != 0 && bcount > obcount)
> > 					vfs_bio_bzero_buf(bp, obcount, bcount -
> > 					    obcount);
> > *** This zeros bytes from "obcount" (the offset of the old EOF) to
> > "bcount"
> >     (which is the offset of EOF after the write).
> 
> I believe that I got it now, the patch in the other message looks
> fine.
> Thank you for the patience.
> 
Thanks for the review. It got me to look more closely at the patch and replace
"bcount" with "on", plus other improvements.

Have fun, rick



More information about the freebsd-fs mailing list