From: Lai Siyao Date: Wed, 2 Feb 2011 12:45:02 +0000 (+0100) Subject: b=23064 create proper macro check for bdi interface X-Git-Tag: 1.8.5.54~1 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=f86d6d4635dd41cb825c4269bd997b0d0a513b12;p=fs%2Flustre-release.git b=23064 create proper macro check for bdi interface i=johann --- diff --git a/lustre/ChangeLog b/lustre/ChangeLog index b16175c..1e8ab27 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -95,6 +95,10 @@ Description: ASSERTION(atomic_read(&client_stat->nid_exp_ref_count) == 0) Details : Reconnecting from a different nid causes old per-nid stats not to be released. +Severity : normal +Bugzilla : 23064 +Description: create proper macro check for bdi interface. + ------------------------------------------------------------------------------- 2010-10-29 Oracle, Inc. diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 006f3b1..057ded5 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -1764,18 +1764,28 @@ LB_LINUX_TRY_COMPILE([ ]) ]) -# 2.6.32 has new BDI interface. -AC_DEFUN([LC_NEW_BACKING_DEV_INFO], -[AC_MSG_CHECKING([if backing_dev_info has a bdi_list field]) +# 2.6.32 has bdi_register() functions. +AC_DEFUN([LC_EXPORT_BDI_REGISTER], +[LB_CHECK_SYMBOL_EXPORT([bdi_register], +[mm/backing-dev.c],[ + AC_DEFINE(HAVE_BDI_REGISTER, 1, + [bdi_register function is present]) +],[ +]) +]) + +# 2.6.32 add s_bdi for super block +AC_DEFUN([LC_SB_BDI], +[AC_MSG_CHECKING([if super_block has s_bdi field]) LB_LINUX_TRY_COMPILE([ - #include + #include ],[ - struct backing_dev_info bdi; - memset(&bdi.bdi_list, 0x00, sizeof(bdi.bdi_list)); + struct super_block sb; + sb.s_bdi = NULL; ],[ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_NEW_BACKING_DEV_INFO, 1, - [backing_dev_info has a bdi_list field]) + AC_DEFINE(HAVE_SB_BDI, 1, + [super_block has s_bdi field]) ],[ AC_MSG_RESULT(no) ]) @@ -1989,7 +1999,8 @@ AC_DEFUN([LC_PROG_LINUX], LC_BLK_QUEUE_LOG_BLK_SIZE # 2.6.32 - LC_NEW_BACKING_DEV_INFO + LC_EXPORT_BDI_REGISTER + LC_SB_BDI if test x$enable_server = xyes ; then LC_WALK_SPACE_HAS_DATA_SEM fi diff --git a/lustre/include/lustre_disk.h b/lustre/include/lustre_disk.h index 791f356..7446b9f 100644 --- a/lustre/include/lustre_disk.h +++ b/lustre/include/lustre_disk.h @@ -297,12 +297,13 @@ struct lustre_sb_info { struct ll_sb_info *lsi_llsbi; /* add'l client sbi info */ struct vfsmount *lsi_srv_mnt; /* the one server mount */ atomic_t lsi_mounts; /* references to the srv_mnt */ - struct backing_dev_info bdi; /* Each client mountpoint needs own backing_dev_info */ + struct backing_dev_info lsi_bdi; /* each client mountpoint needs own backing_dev_info */ }; #define LSI_SERVER 0x00000001 #define LSI_UMOUNT_FORCE 0x00000010 #define LSI_UMOUNT_FAILOVER 0x00000020 +#define LSI_BDI_INITIALIZED 0x00000040 #define s2lsi(sb) ((struct lustre_sb_info *)((sb)->s_fs_info)) #define s2lsi_nocast(sb) ((sb)->s_fs_info) diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index dcc0862..72f9b13 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -998,7 +998,7 @@ out: } /* end COMPAT_146 */ -#ifdef HAVE_NEW_BACKING_DEV_INFO +#ifdef HAVE_BDI_REGISTER static atomic_t ll_bdi_num = ATOMIC_INIT(0); #endif @@ -1134,16 +1134,19 @@ int ll_fill_super(struct super_block *sb) GOTO(out_free, err); #ifdef HAVE_BDI_INIT - err = bdi_init(&lsi->bdi); + err = bdi_init(&lsi->lsi_bdi); if (err) GOTO(out_free, err); + lsi->lsi_flags |= LSI_BDI_INITIALIZED; + lsi->lsi_bdi.capabilities = BDI_CAP_MAP_COPY; +#ifdef HAVE_BDI_REGISTER + err = bdi_register(&lsi->lsi_bdi, NULL, "lustre-%d", + atomic_inc_return(&ll_bdi_num)); #endif -#ifdef HAVE_NEW_BACKING_DEV_INFO - lsi->bdi.name = "lustre"; - lsi->bdi.capabilities = BDI_CAP_MAP_COPY; - err = bdi_register(&lsi->bdi, NULL, "lustre-%d", - atomic_inc_return(&ll_bdi_num)); - sb->s_bdi = &lsi->bdi; +#endif + +#ifdef HAVE_SB_BDI + sb->s_bdi = &lsi->lsi_bdi; #endif out_free: @@ -1208,13 +1211,10 @@ void ll_put_super(struct super_block *sb) if (profilenm) class_del_profile(profilenm); -#ifdef HAVE_NEW_BACKING_DEV_INFO - if (lsi->bdi.wb_cnt > 0) { -#endif #ifdef HAVE_BDI_INIT - bdi_destroy(&lsi->bdi); -#endif -#ifdef HAVE_NEW_BACKING_DEV_INFO + if (lsi->lsi_flags & LSI_BDI_INITIALIZED) { + bdi_destroy(&lsi->lsi_bdi); + lsi->lsi_flags &= ~LSI_BDI_INITIALIZED; } #endif @@ -2014,7 +2014,7 @@ void ll_read_inode2(struct inode *inode, void *opaque) /* OIDEBUG(inode); */ /* initializing backing dev info. */ - inode->i_mapping->backing_dev_info = &(s2lsi(inode->i_sb)->bdi); + inode->i_mapping->backing_dev_info = &s2lsi(inode->i_sb)->lsi_bdi; if (S_ISREG(inode->i_mode)) { struct ll_sb_info *sbi = ll_i2sbi(inode);