Always unload zpios.ko on exit
[zfs.git] / module / zfs / zfs_vnops.c
index cb66741..5b47cba 100644 (file)
@@ -220,7 +220,11 @@ zfs_close(struct inode *ip, int flag, cred_t *cr)
        ZFS_ENTER(zsb);
        ZFS_VERIFY_ZP(zp);
 
-       /* Decrement the synchronous opens in the znode */
+       /*
+        * Zero the synchronous opens in the znode.  Under Linux the
+        * zfs_close() hook is not symmetric with zfs_open(), it is
+        * only called once when the last reference is dropped.
+        */
        if (flag & O_SYNC)
                zp->z_sync_cnt = 0;
 
@@ -335,7 +339,7 @@ mappedread(struct inode *ip, int nbytes, uio_t *uio)
 }
 #endif /* _KERNEL */
 
-offset_t zfs_read_chunk_size = 1024 * 1024; /* Tunable */
+unsigned long zfs_read_chunk_size = 1024 * 1024; /* Tunable */
 
 /*
  * Read bytes from specified file into supplied buffer.
@@ -2335,7 +2339,7 @@ zfs_setattr(struct inode *ip, vattr_t *vap, int flags, cred_t *cr)
        zfs_acl_t       *aclp;
        boolean_t skipaclchk = (flags & ATTR_NOACLCHECK) ? B_TRUE : B_FALSE;
        boolean_t       fuid_dirtied = B_FALSE;
-       sa_bulk_attr_t  bulk[7], xattr_bulk[7];
+       sa_bulk_attr_t  *bulk, *xattr_bulk;
        int             count = 0, xattr_count = 0;
 
        if (mask == 0)
@@ -2378,6 +2382,9 @@ zfs_setattr(struct inode *ip, vattr_t *vap, int flags, cred_t *cr)
        tmpxvattr = kmem_alloc(sizeof(xvattr_t), KM_SLEEP);
        xva_init(tmpxvattr);
 
+       bulk = kmem_alloc(sizeof(sa_bulk_attr_t) * 7, KM_SLEEP);
+       xattr_bulk = kmem_alloc(sizeof(sa_bulk_attr_t) * 7, KM_SLEEP);
+
        /*
         * Immutable files can only alter immutable bit and atime
         */
@@ -2918,6 +2925,8 @@ out2:
                zil_commit(zilog, 0);
 
 out3:
+       kmem_free(xattr_bulk, sizeof(sa_bulk_attr_t) * 7);
+       kmem_free(bulk, sizeof(sa_bulk_attr_t) * 7);
        kmem_free(tmpxvattr, sizeof(xvattr_t));
        ZFS_EXIT(zsb);
        return (err);
@@ -4711,3 +4720,8 @@ zfs_retzcbuf(struct inode *ip, xuio_t *xuio, cred_t *cr)
        return (0);
 }
 #endif /* HAVE_UIO_ZEROCOPY */
+
+#if defined(_KERNEL) && defined(HAVE_SPL)
+module_param(zfs_read_chunk_size, long, 0644);
+MODULE_PARM_DESC(zfs_read_chunk_size, "Bytes to read per chunk");
+#endif