LINUX: Switch to new bdi api for 4.12.

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>
This commit is contained in:
Joe Gorse 2017-05-16 07:29:30 +00:00 committed by Benjamin Kaduk
parent b47dc5482d
commit 63e530e7df
2 changed files with 14 additions and 1 deletions

View 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>],

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