LINUX: Switch to new bdi api for 4.12. 14/12614/5
authorJoe Gorse <jhgorse@gmail.com>
Tue, 16 May 2017 07:29:30 +0000 (07:29 +0000)
committerBenjamin Kaduk <kaduk@mit.edu>
Tue, 30 May 2017 03:32:37 +0000 (23:32 -0400)
super_setup_bdi() dynamically allocates backing_dev_info structures
for filesystems and cleans them up on superblock destruction.

Appears with Linux commit fca39346a55bb7196888ffc77d9e3557340d1d0b
Author: Jan Kara <jack@suse.cz>
Date:   Wed Apr 12 12:24:28 2017 +0200

Change-Id: I67eed0fcb8c96733390579847db57fb8a4f0df3e
Reviewed-on: https://gerrit.openafs.org/12614
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

acinclude.m4
src/afs/LINUX/osi_vfsops.c

index 99a5691..38e6161 100644 (file)
@@ -1006,6 +1006,10 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                  AC_CHECK_LINUX_FUNC([bdi_init],
                                     [#include <linux/backing-dev.h>],
                                     [bdi_init(NULL);])
+                 AC_CHECK_LINUX_FUNC([super_setup_bdi],
+                                     [#include <linux/backing-dev.h>],
+                                     [struct super_block *sb;
+                                     super_setup_bdi(sb);])
                  AC_CHECK_LINUX_FUNC([PageChecked],
                                     [#include <linux/mm.h>
 #include <linux/page-flags.h>],
index a0bcc85..f87d137 100644 (file)
@@ -113,7 +113,13 @@ afs_fill_super(struct super_block *sb, void *data, int silent)
 #if defined(STRUCT_SUPER_BLOCK_HAS_S_D_OP)
     sb->s_d_op = &afs_dentry_operations;
 #endif
-
+#if defined(HAVE_LINUX_SUPER_SETUP_BDI)
+    code = super_setup_bdi(sb);
+    if (code)
+        goto out;
+    sb->s_bdi->name = "openafs";
+    sb->s_bdi->ra_pages = 32;
+#else
     /* used for inodes backing_dev_info field, also */
     afs_backing_dev_info = kzalloc(sizeof(struct backing_dev_info), GFP_NOFS);
 #if defined(HAVE_LINUX_BDI_INIT)
@@ -131,6 +137,7 @@ afs_fill_super(struct super_block *sb, void *data, int silent)
     /* The name specified here will appear in the flushing thread name - flush-afs */
     bdi_register(afs_backing_dev_info, NULL, "afs");
 #endif
+#endif /* HAVE_LINUX_SUPER_SETUP_BDI */
 #if !defined(AFS_NONFSTRANS)
     sb->s_export_op = &afs_export_ops;
 #endif
@@ -157,7 +164,9 @@ out:
        if (bdi_init_done)
            bdi_destroy(afs_backing_dev_info);
 #endif
+#if !defined(HAVE_LINUX_SUPER_SETUP_BDI)
        kfree(afs_backing_dev_info);
+#endif
         module_put(THIS_MODULE);
     }