Patch review reguest: zfs_znode.c
Kostik Belousov
kostikbel at gmail.com
Wed Aug 24 17:51:32 UTC 2011
On Wed, Aug 24, 2011 at 07:37:58PM +0200, Martin Matuska wrote:
> On 24. 8. 2011 15:45, Kostik Belousov wrote:
> > On Wed, Aug 24, 2011 at 03:14:47PM +0200, Martin Matuska wrote:
> >> Hi Kostik,
> >>
> >> could you please review the attached patch?
> >>
> >> It fixes kern/160035 and kern/156933.
> >> http://www.freebsd.org/cgi/query-pr.cgi?pr=160035
> >>
> >> The function zfs_rezget() is called as part of zfs_resume_fs().
> >> Suspending and resuming a ZFS filesystem is used in three cases:
> >> 1.) zfs rollback
> >> 2.) snapshot receive on a mounted fs (zfs recv -F)
> >> 3.) zfs upgrade
> >>
> >> In case 1.) and 2.) the filesystem usually changes (changed/deleted/new files/directories).
> >>
> >> To make sure we don't have mmaped wrong data we have to invalidate
> >> buffers for all vnodes of the resuming fs.
> >>
> >> Thank you very much,
> >> Martin
> >>
> > Uh. Does ZFS use the buffer cache at all ?
> >
> > Could it be that all you need is a call to vm_object_page_remove(vp->v_object,
> > 0, 0) ?
> Yes, that seems to be enough.
> Updated patch attached.
>
> --
> Martin Matuska
> FreeBSD committer
> http://blog.vx.sk
>
> Index: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c
> ===================================================================
> --- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c (revision 225140)
> +++ sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c (working copy)
> @@ -1343,6 +1343,12 @@
>
> zp->z_unlinked = (zp->z_links == 0);
> zp->z_blksz = doi.doi_data_block_size;
> +
> + if (ZTOV(zp)->v_object != NULL) {
> + VM_OBJECT_LOCK(ZTOV(zp)->v_object);
> + vm_object_page_remove(ZTOV(zp)->v_object, 0, 0, 0);
> + VM_OBJECT_UNLOCK(ZTOV(zp)->v_object);
> + }
> if (zp->z_size != size && ZTOV(zp) != NULL)
> vnode_pager_setsize(ZTOV(zp), zp->z_size);
>
I recommend you to create a local variable of the type vm_object_t
and use it, instead of dereferencing the long chain of pointers.
Also, consider moving ffs_pages_remove out from ffs_inode() into vfs_vnops.c,
calling it e.g. vn_pages_remove(), and use it instead.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/zfs-devel/attachments/20110824/40fa0fb7/attachment.pgp
More information about the zfs-devel
mailing list