]> granicus.if.org Git - zfs/commitdiff
Add zp->z_is_zvol flag
authorBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 8 Feb 2011 19:29:50 +0000 (11:29 -0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 10 Feb 2011 17:27:21 +0000 (09:27 -0800)
A new flag is required for the zfs_rlock code to determine if
it is operation of the zvol of zpl dataset.  This used to be
keyed off the zp->z_vnode, which was a hack to begin with, but
with the removal of vnodes we needed a dedicated flag.

include/sys/zfs_znode.h
module/zfs/zfs_rlock.c
module/zfs/zvol.c

index 2f25cc7fe378cda53f45d6dd61d2da9a7e3d84b0..53bd181099d0e1f504388d30735077aa48b51c5f 100644 (file)
@@ -209,7 +209,7 @@ typedef struct znode {
        list_node_t     z_link_node;    /* all znodes in fs link */
        sa_handle_t     *z_sa_hdl;      /* handle to sa data */
        boolean_t       z_is_sa;        /* are we native sa? */
-       void (*z_set_ops_inode) (struct inode *); /* set inode ops */
+       boolean_t       z_is_zvol;      /* are we used by the zvol */
        struct inode    z_inode;        /* generic vfs inode */
 } znode_t;
 
index 6709ce80b65a89571555a1c51690b94f92b5ee2f..9362fb4e82b0de88f68e482eca759d98bb614526 100644 (file)
@@ -112,14 +112,14 @@ zfs_range_lock_writer(znode_t *zp, rl_t *new)
                 * Range locking is also used by zvol and uses a
                 * dummied up znode. However, for zvol, we don't need to
                 * append or grow blocksize, and besides we don't have
-                * a "sa" data or z_zfsvfs - so skip that processing.
+                * a "sa" data or zfs_sb_t - so skip that processing.
                 *
                 * Yes, this is ugly, and would be solved by not handling
                 * grow or append in range lock code. If that was done then
                 * we could make the range locking code generically available
                 * to other non-zfs consumers.
                 */
-               if (zp->z_vnode) { /* caller is ZPL */
+               if (!zp->z_is_zvol) { /* caller is ZPL */
                        /*
                         * If in append mode pick up the current end of file.
                         * This is done under z_range_lock to avoid races.
index b2a08fb437c62a7e4a8160ca1a4f3b06bf7518c7..3d829a3d413942e521832e7e6b082c6897ba98e6 100644 (file)
@@ -1062,6 +1062,8 @@ zvol_alloc(dev_t dev, const char *name)
        mutex_init(&zv->zv_znode.z_range_lock, NULL, MUTEX_DEFAULT, NULL);
        avl_create(&zv->zv_znode.z_range_avl, zfs_range_compare,
            sizeof (rl_t), offsetof(rl_t, r_node));
+       zv->zv_znode.z_is_zvol = TRUE;
+
        spin_lock_init(&zv->zv_lock);
        list_link_init(&zv->zv_next);