Whamcloud - gitweb
LU-1756 kernel: clean up lustre_compat25.h
authorPeng Tao <tao.peng@emc.com>
Thu, 16 Aug 2012 07:59:21 +0000 (15:59 +0800)
committerOleg Drokin <green@whamcloud.com>
Mon, 29 Oct 2012 05:57:29 +0000 (01:57 -0400)
1. unused functions:
   mapping_has_pages(), ll_call_writepage(), __set_page_ll_data()
   ll_invalidate_inode_pages(), __set_page_ll_data()
   CheckWriteback(), KIOBUF_GET_BLOCKS()
2. rename ll_vfs_create to vfs_create
3. remove kdev_t related macros
4. move cfs_cleanup_group_info() to lustre_common.h
5. remove kiobuf
6. move ll_inode_blksize() to lustre_common.h
7. drop LL_RENAME_DOES_D_MOVE

Signed-off-by: Peng Tao <tao.peng@emc.com>
Change-Id: Ic5e29e399e70ccd04cbe1448f3c6cfc3a258289b
Reviewed-on: http://review.whamcloud.com/3686
Tested-by: Hudson
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
22 files changed:
libcfs/include/libcfs/darwin/darwin-types.h
libcfs/include/libcfs/winnt/winnt-types.h
lustre/include/darwin/lustre_compat.h
lustre/include/darwin/obd_class.h
lustre/include/liblustre.h
lustre/include/linux/Makefile.am
lustre/include/linux/lustre_common.h [new file with mode: 0644]
lustre/include/linux/lustre_compat25.h
lustre/include/linux/lustre_fsfilt.h
lustre/include/linux/lustre_lib.h
lustre/include/linux/lustre_lite.h
lustre/include/linux/lvfs.h
lustre/include/linux/lvfs_linux.h
lustre/include/linux/obd_class.h
lustre/include/linux/obd_support.h
lustre/llite/file.c
lustre/llite/llite_lib.c
lustre/llite/namei.c
lustre/llite/rw.c
lustre/llite/rw26.c
lustre/lvfs/lvfs_linux.c
lustre/obdclass/obd_mount.c

index b889c40..4a11fdd 100644 (file)
@@ -69,7 +69,6 @@ typedef long long_ptr_t;
 
 
 typedef struct { int e; }              event_chan_t;
-typedef dev_t                          kdev_t;
 
 /*
  * Atmoic define
index 7b805c8..b8da381 100644 (file)
@@ -154,8 +154,6 @@ typedef unsigned long ulong_ptr_t;
 
 typedef __u32           off_t;
 
-typedef unsigned short  kdev_t;
-
 typedef __u32           pid_t;
 typedef __u32           tid_t;
 
index ea9433f..05c8961 100644 (file)
@@ -97,10 +97,6 @@ static inline int ll_path_lookup(const char *path, unsigned int flags, struct na
 }
 #endif
 
-#define to_kdev_t(dev)                  (dev)
-#define kdev_t_to_nr(dev)               (dev)
-#define val_to_kdev(dev)                (dev)
-
 #define ext2_test_bit  test_bit
 
 #endif /* __KERNEL__ */
index 7756155..6c77a44 100644 (file)
@@ -39,8 +39,4 @@
 #error Do not #include this file directly. #include <obd_class.h> instead
 #endif
 
-#if !defined(__KERNEL__)
-#define to_kdev_t(dev)          (dev)
-#endif
-
 #endif /* __XNU_OBD_CLASS_H */
index 4e10448..bf34f04 100644 (file)
@@ -131,8 +131,6 @@ extern int echo_client_init(void);
 
 /* general stuff */
 
-typedef __u64 kdev_t;
-
 #ifndef min
 #define min(x,y) ((x)<(y) ? (x) : (y))
 #endif
index 2dd1aae..85d0846 100644 (file)
@@ -44,4 +44,4 @@ EXTRA_DIST = lprocfs_status.h lustre_acl.h lustre_debug.h lustre_lib.h \
        lustre_dlm.h  lustre_handles.h lustre_net.h obd_class.h obd_support.h \
        lustre_log.h lustre_compat25.h lustre_fsfilt.h lustre_mds.h \
        obd.h lvfs.h lvfs_linux.h lustre_lite.h lustre_quota.h \
-       lustre_user.h lustre_patchless_compat.h lustre_intent.h
+       lustre_user.h lustre_patchless_compat.h lustre_intent.h lustre_common.h
diff --git a/lustre/include/linux/lustre_common.h b/lustre/include/linux/lustre_common.h
new file mode 100644 (file)
index 0000000..d1783a3
--- /dev/null
@@ -0,0 +1,22 @@
+#ifndef LUSTRE_COMMON_H
+#define LUSTRE_COMMON_H
+
+#include <linux/sched.h>
+
+static inline int cfs_cleanup_group_info(void)
+{
+       struct group_info *ginfo;
+
+       ginfo = groups_alloc(0);
+       if (!ginfo)
+               return -ENOMEM;
+
+       set_current_groups(ginfo);
+       put_group_info(ginfo);
+
+       return 0;
+}
+
+#define ll_inode_blksize(a)            (1<<(a)->i_blkbits)
+
+#endif
index 6b8d155..6173836 100644 (file)
@@ -37,8 +37,6 @@
 #ifndef _LINUX_COMPAT25_H
 #define _LINUX_COMPAT25_H
 
-#ifdef __KERNEL__
-
 #include <linux/fs_struct.h>
 #include <linux/namei.h>
 #include <libcfs/linux/portals_compat25.h>
@@ -136,20 +134,6 @@ static inline void ll_set_fs_pwd(struct fs_struct *fs, struct vfsmount *mnt,
         generic_permission(inode, mask, check_acl)
 #endif
 
-#define ll_pgcache_lock(mapping)          cfs_spin_lock(&mapping->page_lock)
-#define ll_pgcache_unlock(mapping)        cfs_spin_unlock(&mapping->page_lock)
-#define ll_call_writepage(inode, page)  \
-                                (inode)->i_mapping->a_ops->writepage(page, NULL)
-#define ll_invalidate_inode_pages(inode) \
-                                invalidate_inode_pages((inode)->i_mapping)
-
-#define ll_vfs_create(a,b,c,d)          vfs_create(a,b,c,d)
-#define ll_dev_t                        dev_t
-#define kdev_t                          dev_t
-#define to_kdev_t(dev)                  (dev)
-#define kdev_t_to_nr(dev)               (dev)
-#define val_to_kdev(dev)                (dev)
-
 #ifdef HAVE_BLKDEV_PUT_2ARGS
 #define ll_blkdev_put(a, b) blkdev_put(a, b)
 #else
@@ -162,65 +146,6 @@ static inline void ll_set_fs_pwd(struct fs_struct *fs, struct vfsmount *mnt,
 #define ll_dentry_open(a, b, c, d) dentry_open(a, b, c)
 #endif
 
-#include <linux/writeback.h>
-
-static inline int cfs_cleanup_group_info(void)
-{
-        struct group_info *ginfo;
-
-        ginfo = groups_alloc(0);
-        if (!ginfo)
-                return -ENOMEM;
-
-        set_current_groups(ginfo);
-        put_group_info(ginfo);
-
-        return 0;
-}
-
-#define __set_page_ll_data(page, llap) \
-        do {       \
-                page_cache_get(page); \
-                SetPagePrivate(page); \
-                set_page_private(page, (unsigned long)llap); \
-        } while (0)
-#define __clear_page_ll_data(page) \
-        do {       \
-                ClearPagePrivate(page); \
-                set_page_private(page, 0); \
-                page_cache_release(page); \
-        } while(0)
-
-#define kiobuf bio
-
-#include <linux/proc_fs.h>
-
-#define CheckWriteback(page, cmd) \
-        ((!PageWriteback(page) && (cmd & OBD_BRW_READ)) || \
-         (PageWriteback(page) && (cmd & OBD_BRW_WRITE)))
-
-#ifdef HAVE_PAGE_LIST
-static inline int mapping_has_pages(struct address_space *mapping)
-{
-        int rc = 1;
-
-        ll_pgcache_lock(mapping);
-        if (cfs_list_empty(&mapping->dirty_pages) &&
-            cfs_list_empty(&mapping->clean_pages) &&
-            cfs_list_empty(&mapping->locked_pages)) {
-                rc = 0;
-        }
-        ll_pgcache_unlock(mapping);
-
-        return rc;
-}
-#else
-static inline int mapping_has_pages(struct address_space *mapping)
-{
-        return mapping->nrpages > 0;
-}
-#endif
-
 #ifdef HAVE_KIOBUF_KIO_BLOCKS
 #define KIOBUF_GET_BLOCKS(k) ((k)->kio_blocks)
 #else
@@ -313,12 +238,12 @@ int ll_unregister_blkdev(unsigned int dev, const char *name)
 #define ll_invalidate_bdev(a,b)         invalidate_bdev((a))
 #endif
 
-#define ll_inode_blksize(a)     (1<<(a)->i_blkbits)
+#ifndef FS_HAS_FIEMAP
+#define FS_HAS_FIEMAP                  (0)
+#endif
 
-#ifdef HAVE_FS_RENAME_DOES_D_MOVE
-#define LL_RENAME_DOES_D_MOVE   FS_RENAME_DOES_D_MOVE
-#else
-#define LL_RENAME_DOES_D_MOVE   FS_ODD_RENAME
+#ifndef HAVE_FS_RENAME_DOES_D_MOVE
+#define FS_RENAME_DOES_D_MOVE          FS_ODD_RENAME
 #endif
 
 #ifndef HAVE_D_OBTAIN_ALIAS
@@ -762,5 +687,4 @@ static inline bool selinux_is_enabled(void)
 # define lm_compare_owner      fl_compare_owner
 #endif
 
-#endif /* __KERNEL__ */
 #endif /* _COMPAT25_H */
index 3eddc33..d665c1f 100644 (file)
@@ -97,7 +97,7 @@ struct fsfilt_operations {
          * IO was submitted successfully.
          *
          */
-        int     (* fs_send_bio)(int rw, struct inode *inode,struct kiobuf *bio);
+       int     (* fs_send_bio)(int rw, struct inode *inode, struct bio *bio);
         ssize_t (* fs_readpage)(struct file *file, char *buf, size_t count,
                                 loff_t *offset);
         int     (* fs_add_journal_cb)(struct obd_device *obd, __u64 last_rcvd,
index b3094c0..17f1428 100644 (file)
@@ -53,8 +53,9 @@
 # include <linux/sched.h>
 # include <linux/signal.h>
 # include <linux/types.h>
+# include <linux/lustre_compat25.h>
+# include <linux/lustre_common.h>
 #endif
-#include <linux/lustre_compat25.h>
 
 #ifndef LP_POISON
 #if BITS_PER_LONG > 32
index ae10fef..5a4d91f 100644 (file)
@@ -55,6 +55,7 @@
 
 #include <linux/rbtree.h>
 #include <linux/lustre_compat25.h>
+#include <linux/lustre_common.h>
 #include <linux/pagemap.h>
 
 /* lprocfs.c */
index e2866a5..7e502f3 100644 (file)
@@ -45,6 +45,7 @@
 
 #if defined __KERNEL__
 #include <linux/lustre_compat25.h>
+#include <linux/lustre_common.h>
 #include <linux/lvfs_linux.h>
 #else
 #include <liblustre.h>
index c10bf02..cd6c2d1 100644 (file)
@@ -74,7 +74,6 @@ struct lvfs_dentry_params
 #define LVFS_DENTRY_PARAMS_INIT         { .ldp_magic = LVFS_DENTRY_PARAM_MAGIC }
 
 #define BDEVNAME_DECLARE_STORAGE(foo) char foo[BDEVNAME_SIZE]
-#define ll_bdevname(SB, STORAGE) __bdevname(kdev_t_to_nr(SB->s_dev), STORAGE)
 #define lvfs_sbdev(SB)       ((SB)->s_bdev)
 #define lvfs_sbdev_type      struct block_device *
 #define lvfs_sbdev_sync      fsync_bdev
index 8cc4fc8..e1bda84 100644 (file)
@@ -60,9 +60,4 @@ void obdo_to_inode(struct inode *dst, struct obdo *src, obd_flag valid);
 #endif
 
 
-#if !defined(__KERNEL__)
-#define to_kdev_t(dev) dev
-#define kdev_t_to_nr(dev) dev
-#endif
-
 #endif /* __LINUX_OBD_CLASS_H */
index 69149cf..a1ca994 100644 (file)
 #include <linux/slab.h>
 #include <linux/highmem.h>
 #include <linux/swap.h>
+#include <linux/lustre_compat25.h>
+#include <linux/lustre_common.h>
 #endif
 #include <libcfs/libcfs.h>
-#include <linux/lustre_compat25.h>
 #include <lustre/lustre_idl.h>
 
 
index d03ec76..fc92452 100644 (file)
@@ -2488,7 +2488,7 @@ int ll_getattr_it(struct vfsmount *mnt, struct dentry *de,
         stat->nlink = inode->i_nlink;
         stat->uid = inode->i_uid;
         stat->gid = inode->i_gid;
-        stat->rdev = kdev_t_to_nr(inode->i_rdev);
+       stat->rdev = inode->i_rdev;
         stat->atime = inode->i_atime;
         stat->mtime = inode->i_mtime;
         stat->ctime = inode->i_ctime;
index d62ce20..627703e 100644 (file)
@@ -1860,8 +1860,8 @@ void ll_read_inode2(struct inode *inode, void *opaque)
         } else {
                 inode->i_op = &ll_special_inode_operations;
 
-                init_special_inode(inode, inode->i_mode,
-                                   kdev_t_to_nr(inode->i_rdev));
+               init_special_inode(inode, inode->i_mode,
+                                  inode->i_rdev);
 
                 EXIT;
         }
index 7521e3d..0d28211 100644 (file)
@@ -1129,10 +1129,10 @@ static int ll_rename_generic(struct inode *src, struct dentry *src_dparent,
 }
 
 static int ll_mknod(struct inode *dir, struct dentry *dchild, int mode,
-                    ll_dev_t rdev)
+                   dev_t rdev)
 {
-        return ll_mknod_generic(dir, &dchild->d_name, mode,
-                                old_encode_dev(rdev), dchild);
+       return ll_mknod_generic(dir, &dchild->d_name, mode,
+                               old_encode_dev(rdev), dchild);
 }
 
 static int ll_unlink(struct inode * dir, struct dentry *dentry)
index 8079d29..e4244ba 100644 (file)
@@ -44,7 +44,7 @@
 #include <linux/stat.h>
 #include <linux/errno.h>
 #include <linux/unistd.h>
-#include <linux/version.h>
+#include <linux/writeback.h>
 #include <asm/system.h>
 #include <asm/uaccess.h>
 
index 917ba3f..75d2fd5 100644 (file)
@@ -44,7 +44,6 @@
 #include <linux/stat.h>
 #include <linux/errno.h>
 #include <linux/unistd.h>
-#include <linux/version.h>
 #include <asm/system.h>
 #include <asm/uaccess.h>
 
index aaf70a8..163827a 100644 (file)
@@ -235,10 +235,10 @@ struct dentry *simple_mknod(struct dentry *dir, char *name, int mode, int fix)
                 GOTO(out_up, dchild);
         }
 
-        err = ll_vfs_create(dir->d_inode, dchild, (mode & ~S_IFMT) | S_IFREG,
-                            NULL);
-        if (err)
-                GOTO(out_err, err);
+       err = vfs_create(dir->d_inode, dchild, (mode & ~S_IFMT) | S_IFREG,
+                           NULL);
+       if (err)
+               GOTO(out_err, err);
 
         RETURN(dchild);
 
index 551c385..f856cba 100644 (file)
@@ -3049,11 +3049,8 @@ struct file_system_type lustre_fs_type = {
         .get_sb       = lustre_get_sb,
 #endif
         .kill_sb      = lustre_kill_super,
-        .fs_flags     = FS_BINARY_MOUNTDATA | FS_REQUIRES_DEV |
-#ifdef FS_HAS_FIEMAP
-                        FS_HAS_FIEMAP |
-#endif
-                        LL_RENAME_DOES_D_MOVE,
+       .fs_flags     = FS_BINARY_MOUNTDATA | FS_REQUIRES_DEV |
+                       FS_HAS_FIEMAP | FS_RENAME_DOES_D_MOVE,
 };
 
 int lustre_register_fs(void)