RFC: NFS client patch to reduce sychronous writes

Konstantin Belousov kostikbel at gmail.com
Sat Nov 30 13:22:59 UTC 2013


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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-fs/attachments/20131130/67f10543/attachment.sig>


More information about the freebsd-fs mailing list