Whamcloud - gitweb
LU-709 build: clean up LC_NR_PAGECACHE/LC_STATFS_DENTRY_PARAM
authorPeng Tao <tao.peng@emc.com>
Tue, 15 May 2012 06:43:58 +0000 (14:43 +0800)
committerOleg Drokin <green@whamcloud.com>
Thu, 26 Jul 2012 04:54:24 +0000 (00:54 -0400)
1. nr_pagecache is not exported from 2.6.18 to latest
2. super_operations->statfs takes dentry instead of superblock
   as first parameter since v2.6.18

Signed-off-by: Peng Tao <tao.peng@emc.com>
Change-Id: I93fd5cdd81b83f0896a1305f5b625fa0c82ef515
Reviewed-on: http://review.whamcloud.com/2319
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Yang Sheng <ys@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/autoconf/lustre-core.m4
lustre/include/linux/lustre_compat25.h
lustre/include/linux/lustre_patchless_compat.h
lustre/llite/llite_internal.h
lustre/llite/llite_lib.c
lustre/lvfs/fsfilt_ext3.c
lustre/obdclass/obd_mount.c
lustre/osd-ldiskfs/osd_handler.c

index 6f6fd31..0ee0a91 100644 (file)
@@ -484,47 +484,6 @@ EXTRA_KCFLAGS="$tmp_flags"
 
 # 2.6.18
 
-# LC_NR_PAGECACHE
-# 2.6.18 don't export nr_pagecahe
-AC_DEFUN([LC_NR_PAGECACHE],
-[AC_MSG_CHECKING([kernel export nr_pagecache])
-LB_LINUX_TRY_COMPILE([
-        #include <linux/pagemap.h>
-],[
-        return atomic_read(&nr_pagecache);
-],[
-        AC_MSG_RESULT(yes)
-        AC_DEFINE(HAVE_NR_PAGECACHE, 1,
-                [is kernel export nr_pagecache])
-],[
-        AC_MSG_RESULT(no)
-])
-])
-
-#
-# LC_STATFS_DENTRY_PARAM
-# starting from 2.6.18 linux kernel uses dentry instead of super_block
-# for the first parameter of the super_operations->statfs() callback.
-#
-#
-AC_DEFUN([LC_STATFS_DENTRY_PARAM],
-[AC_MSG_CHECKING([if super_ops.statfs() first parameter is dentry])
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_LINUX_TRY_COMPILE([
-        #include <linux/fs.h>
-],[
-        ((struct super_operations *)0)->statfs((struct dentry *)0, (struct kstatfs*)0);
-],[
-        AC_DEFINE(HAVE_STATFS_DENTRY_PARAM, 1,
-                  [super_ops.statfs() first parameter is dentry])
-        AC_MSG_RESULT([yes])
-],[
-        AC_MSG_RESULT([no])
-])
-EXTRA_KCFLAGS="$tmp_flags"
-])
-
 # LC_UMOUNTBEGIN_HAS_VFSMOUNT
 # 2.6.18~2.6.25 umount_begin has different parameters
 AC_DEFUN([LC_UMOUNTBEGIN_HAS_VFSMOUNT],
@@ -1921,8 +1880,6 @@ AC_DEFUN([LC_PROG_LINUX],
          LC_RW_TREE_LOCK
 
          # 2.6.18
-         LC_NR_PAGECACHE
-         LC_STATFS_DENTRY_PARAM
          LC_UMOUNTBEGIN_HAS_VFSMOUNT
          LC_FLUSH_OWNER_ID
          if test x$enable_server = xyes ; then
index b717b90..28ca758 100644 (file)
@@ -307,12 +307,6 @@ static inline unsigned int mnt_get_count(struct vfsmount *mnt)
 # define mnt_get_count(mnt)      cfs_atomic_read(&(real_mount(mnt)->mnt_count))
 #endif
 
-#ifdef HAVE_STATFS_DENTRY_PARAM
-#define ll_do_statfs(sb, sfs) (sb)->s_op->statfs((sb)->s_root, (sfs))
-#else
-#define ll_do_statfs(sb, sfs) (sb)->s_op->statfs((sb), (sfs))
-#endif
-
 #ifdef HAVE_RW_TREE_LOCK
 #define TREE_READ_LOCK_IRQ(mapping)     read_lock_irq(&(mapping)->tree_lock)
 #define TREE_READ_UNLOCK_IRQ(mapping) read_unlock_irq(&(mapping)->tree_lock)
index d79d1c8..9af47ef 100644 (file)
@@ -50,9 +50,6 @@
 
 #ifndef HAVE_DELETE_FROM_PAGE_CACHE /* 2.6.39 */
 #ifndef HAVE_REMOVE_FROM_PAGE_CACHE /* 2.6.35 - 2.6.38 */
-#ifdef HAVE_NR_PAGECACHE /* 2.6.18 */
-#define __dec_zone_page_state(page, flag) atomic_add(-1, &nr_pagecache);
-#endif /* HAVE_NR_PAGECACHE */
 
 /* XXX copy & paste from 2.6.15 kernel */
 static inline void ll_remove_from_page_cache(struct page *page)
index 510a9b9..02f80bf 100644 (file)
@@ -803,11 +803,7 @@ struct inode *ll_inode_from_lock(struct ldlm_lock *lock);
 void ll_clear_inode(struct inode *inode);
 int ll_setattr_raw(struct dentry *dentry, struct iattr *attr);
 int ll_setattr(struct dentry *de, struct iattr *attr);
-#ifndef HAVE_STATFS_DENTRY_PARAM
-int ll_statfs(struct super_block *sb, struct kstatfs *sfs);
-#else
 int ll_statfs(struct dentry *de, struct kstatfs *sfs);
-#endif
 int ll_statfs_internal(struct super_block *sb, struct obd_statfs *osfs,
                        __u64 max_age, __u32 flags);
 void ll_update_inode(struct inode *inode, struct lustre_md *md);
index 1a24d72..cc747c8 100644 (file)
@@ -1539,16 +1539,11 @@ int ll_statfs_internal(struct super_block *sb, struct obd_statfs *osfs,
 
         RETURN(rc);
 }
-#ifndef HAVE_STATFS_DENTRY_PARAM
-int ll_statfs(struct super_block *sb, struct kstatfs *sfs)
-{
-#else
 int ll_statfs(struct dentry *de, struct kstatfs *sfs)
 {
-        struct super_block *sb = de->d_sb;
-#endif
-        struct obd_statfs osfs;
-        int rc;
+       struct super_block *sb = de->d_sb;
+       struct obd_statfs osfs;
+       int rc;
 
         CDEBUG(D_VFSTRACE, "VFS Op: at "LPU64" jiffies\n", get_jiffies_64());
         ll_stats_ops_tally(ll_s2sbi(sb), LPROC_LL_STAFS, 1);
index 406e744..b341502 100644 (file)
@@ -799,13 +799,13 @@ static int fsfilt_ext3_add_journal_cb(struct obd_device *obd, __u64 last_rcvd,
 
 static int fsfilt_ext3_statfs(struct super_block *sb, struct obd_statfs *osfs)
 {
-        struct kstatfs sfs;
-        int rc;
+       struct kstatfs sfs;
+       int rc;
 
-        memset(&sfs, 0, sizeof(sfs));
-        rc = ll_do_statfs(sb, &sfs);
-        statfs_pack(osfs, &sfs);
-        return rc;
+       memset(&sfs, 0, sizeof(sfs));
+       rc = sb->s_op->statfs(sb->s_root, &sfs);
+       statfs_pack(osfs, &sfs);
+       return rc;
 }
 
 static int fsfilt_ext3_sync(struct super_block *sb)
index e26df3c..f712c4a 100644 (file)
@@ -1800,39 +1800,30 @@ static void server_umount_begin(struct super_block *sb)
         EXIT;
 }
 
-#ifndef HAVE_STATFS_DENTRY_PARAM
-static int server_statfs (struct super_block *sb, cfs_kstatfs_t *buf)
-{
-#else
 static int server_statfs (struct dentry *dentry, cfs_kstatfs_t *buf)
 {
-        struct super_block *sb = dentry->d_sb;
-#endif
-        struct vfsmount *mnt = s2lsi(sb)->lsi_srv_mnt;
-        ENTRY;
+       struct super_block *sb = dentry->d_sb;
+       struct vfsmount *mnt = s2lsi(sb)->lsi_srv_mnt;
+       ENTRY;
 
-        if (mnt && mnt->mnt_sb && mnt->mnt_sb->s_op->statfs) {
-#ifdef HAVE_STATFS_DENTRY_PARAM
-                int rc = mnt->mnt_sb->s_op->statfs(mnt->mnt_root, buf);
-#else
-                int rc = mnt->mnt_sb->s_op->statfs(mnt->mnt_sb, buf);
-#endif
-                if (!rc) {
-                        buf->f_type = sb->s_magic;
-                        RETURN(0);
-                }
-        }
+       if (mnt && mnt->mnt_sb && mnt->mnt_sb->s_op->statfs) {
+               int rc = mnt->mnt_sb->s_op->statfs(mnt->mnt_root, buf);
+               if (!rc) {
+                       buf->f_type = sb->s_magic;
+                       RETURN(0);
+               }
+       }
 
-        /* just return 0 */
-        buf->f_type = sb->s_magic;
-        buf->f_bsize = sb->s_blocksize;
-        buf->f_blocks = 1;
-        buf->f_bfree = 0;
-        buf->f_bavail = 0;
-        buf->f_files = 1;
-        buf->f_ffree = 0;
-        buf->f_namelen = NAME_MAX;
-        RETURN(0);
+       /* just return 0 */
+       buf->f_type = sb->s_magic;
+       buf->f_bsize = sb->s_blocksize;
+       buf->f_blocks = 1;
+       buf->f_bfree = 0;
+       buf->f_bavail = 0;
+       buf->f_files = 1;
+       buf->f_ffree = 0;
+       buf->f_namelen = NAME_MAX;
+       RETURN(0);
 }
 
 /** The operations we support directly on the superblock:
index 2474f69..2db0ff2 100644 (file)
@@ -1007,15 +1007,15 @@ int osd_statfs(const struct lu_env *env, struct dt_device *d,
                 ksfs = &osd_oti_get(env)->oti_ksfs;
         }
 
-        cfs_spin_lock(&osd->od_osfs_lock);
-        /* cache 1 second */
-        if (cfs_time_before_64(osd->od_osfs_age, cfs_time_shift_64(-1))) {
-                result = ll_do_statfs(sb, ksfs);
-                if (likely(result == 0)) { /* N.B. statfs can't really fail */
-                        osd->od_osfs_age = cfs_time_current_64();
-                        statfs_pack(&osd->od_statfs, ksfs);
-                }
-        }
+       cfs_spin_lock(&osd->od_osfs_lock);
+       /* cache 1 second */
+       if (cfs_time_before_64(osd->od_osfs_age, cfs_time_shift_64(-1))) {
+               result = sb->s_op->statfs(sb->s_root, ksfs);
+               if (likely(result == 0)) { /* N.B. statfs can't really fail */
+                       osd->od_osfs_age = cfs_time_current_64();
+                       statfs_pack(&osd->od_statfs, ksfs);
+               }
+       }
 
         if (likely(result == 0))
                 *sfs = osd->od_statfs;