Linux 4.12 compat: super_setup_bdi_name()

All filesystems were converted to dynamically allocated BDIs.  The
destruction of backing_dev_info structures is handled as part of
super block destruction.  Refactor the code to abstract away the
details of creating and destroying a BDI.

Reviewed-by: Chunwei Chen <david.chen@osnexus.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #6089
This commit is contained in:
Brian Behlendorf
2017-05-02 09:46:18 -07:00
committed by GitHub
parent 153b228554
commit 7dae2c81e7
6 changed files with 141 additions and 54 deletions
+6 -5
View File
@@ -1568,7 +1568,8 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolean_t unmounting)
return (0);
}
#if !defined(HAVE_2ARGS_BDI_SETUP_AND_REGISTER) && \
#if !defined(HAVE_SUPER_SETUP_BDI_NAME) && \
!defined(HAVE_2ARGS_BDI_SETUP_AND_REGISTER) && \
!defined(HAVE_3ARGS_BDI_SETUP_AND_REGISTER)
atomic_long_t zfs_bdi_seq = ATOMIC_LONG_INIT(0);
#endif
@@ -1605,13 +1606,13 @@ zfs_domount(struct super_block *sb, zfs_mnt_t *zm, int silent)
sb->s_time_gran = 1;
sb->s_blocksize = recordsize;
sb->s_blocksize_bits = ilog2(recordsize);
zfsvfs->z_bdi.ra_pages = 0;
sb->s_bdi = &zfsvfs->z_bdi;
error = -zpl_bdi_setup_and_register(&zfsvfs->z_bdi, "zfs");
error = -zpl_bdi_setup(sb, "zfs");
if (error)
goto out;
sb->s_bdi->ra_pages = 0;
/* Set callback operations for the file system. */
sb->s_op = &zpl_super_operations;
sb->s_xattr = zpl_xattr_handlers;
@@ -1732,7 +1733,7 @@ zfs_umount(struct super_block *sb)
arc_remove_prune_callback(zfsvfs->z_arc_prune);
VERIFY(zfsvfs_teardown(zfsvfs, B_TRUE) == 0);
os = zfsvfs->z_os;
bdi_destroy(sb->s_bdi);
zpl_bdi_destroy(sb);
/*
* z_os will be NULL if there was an error in