Patch review reguest: zfs_znode.c

Pawel Jakub Dawidek pjd at FreeBSD.org
Wed Aug 24 17:49:18 UTC 2011


On Wed, Aug 24, 2011 at 07:37:58PM +0200, Martin Matuska wrote:
> On 24. 8. 2011 15:45, Kostik Belousov wrote:
> > 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.

> 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);

As you can see after the code you added we check for ZTOV(zp) not being
NULL. If it is possible it can be NULL, you need to check it also before
referencing it.

-- 
Pawel Jakub Dawidek                       http://www.wheelsystems.com
FreeBSD committer                         http://www.FreeBSD.org
Am I Evil? Yes, I Am!                     http://yomoli.com
-------------- 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/c52e608e/attachment.pgp


More information about the zfs-devel mailing list