Whamcloud - gitweb
b=20563 add llite mount option to generate 32bit ino v2
authorpravin <Pravin.Shelar@sun.com>
Wed, 25 Aug 2010 11:50:43 +0000 (17:20 +0530)
committerJohann Lombardi <johann.lombardi@oracle.com>
Wed, 25 Aug 2010 22:32:24 +0000 (00:32 +0200)
i=vitaly
i=andreas
        patch adds mount option to generate 32bit ino, this can be used
for 32bit application compatibility.

lustre/llite/dir.c
lustre/llite/llite_internal.h
lustre/llite/llite_lib.c

index 1160fa8..7a40543 100644 (file)
@@ -804,17 +804,20 @@ static int ll_readdir_20(struct file *filp, void *cookie, filldir_t filldir)
 {
         struct inode         *inode = filp->f_dentry->d_inode;
         __u64                 pos   = filp->f_pos;
+        struct ll_sb_info    *sbi   = ll_i2sbi(inode);
         struct page          *page;
         struct ll_dir_chain   chain;
         int rc;
         int done;
-        int shift;
+        int shift,need_32bit;
         __u16 type;
         ENTRY;
 
-        CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p) pos %lu/%llu\n",
+        need_32bit = ll_need_32bit_api(sbi);
+
+        CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p) pos %lu/%llu 32bit_api %d\n",
                inode->i_ino, inode->i_generation, inode,
-               (unsigned long)pos, i_size_read(inode));
+               (unsigned long)pos, i_size_read(inode), need_32bit);
 
         if (pos == DIR_END_OFF)
                 /*
@@ -868,7 +871,7 @@ static int ll_readdir_20(struct file *filp, void *cookie, filldir_t filldir)
                                 fid  = ent->lde_fid;
                                 name = ent->lde_name;
                                 fid_le_to_cpu(&fid, &fid);
-                                if (cfs_curproc_is_32bit())
+                                if (need_32bit)
                                         ino = ll_fid_build_ino32((struct ll_fid *)&fid);
                                 else
                                         ino = ll_fid_build_ino((struct ll_fid *)&fid);
index 17897b1..0599a3e 100644 (file)
@@ -303,6 +303,7 @@ enum stats_track_type {
 #define LL_SBI_LRU_RESIZE       0x80 /* support lru resize */
 #define LL_SBI_LLITE_CHECKSUM  0x100 /* checksum each page in memory */
 #define LL_SBI_LAZYSTATFS      0x200 /* lazystatfs mount option */
+#define LL_SBI_32BIT_API       0x400 /* generate 32 bit inodes. */
 
 /* default value for ll_sb_info->contention_time */
 #define SBI_DEFAULT_CONTENTION_SECONDS     60
@@ -311,6 +312,15 @@ enum stats_track_type {
 /* default value for ll_direct_io_default */
 #define SBI_DEFAULT_DIRECT_IO_DEFAULT 0
 
+static inline int ll_need_32bit_api(struct ll_sb_info *sbi)
+{
+#if BITS_PER_LONG == 32
+        return 1;
+#else
+        return unlikely(cfs_curproc_is_32bit() || (sbi->ll_flags & LL_SBI_32BIT_API));
+#endif
+}
+
 /* percpu data structure for lustre lru page list */
 struct ll_pglist_data {
         spinlock_t                llpd_lock; /* lock to protect llpg_list */
index c3ca662..cdd958f 100644 (file)
@@ -781,6 +781,11 @@ static int ll_options(char *options, int *flags)
                         *flags &= ~tmp;
                         goto next;
                 }
+                tmp = ll_set_opt("32bitapi", s1, LL_SBI_32BIT_API);
+                if (tmp) {
+                        *flags |= tmp;
+                        goto next;
+                }
                 LCONSOLE_ERROR_MSG(0x152, "Unknown option '%s', won't mount.\n",
                                    s1);
                 RETURN(-EINVAL);