# 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],
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
# 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)
#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)
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);
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);
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)
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:
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;