Whamcloud - gitweb
b=20563
authorpravin <Pravin.Shelar@sun.com>
Fri, 13 Aug 2010 11:19:11 +0000 (15:19 +0400)
committerMikhail Pershin <tappro@sun.com>
Mon, 16 Aug 2010 19:44:49 +0000 (23:44 +0400)
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/file.c
lustre/llite/llite_internal.h
lustre/llite/llite_lib.c

index f145b8c..f5cf954 100644 (file)
@@ -399,17 +399,19 @@ int ll_readdir(struct file *filp, void *cookie, filldir_t filldir)
         struct inode         *inode = filp->f_dentry->d_inode;
         struct ll_inode_info *info  = ll_i2info(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 rc, need_32bit;
         int done;
         int shift;
         __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)
                 /*
@@ -467,7 +469,7 @@ int ll_readdir(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 = cl_fid_build_ino32(&fid);
                                 else
                                         ino = cl_fid_build_ino(&fid);
index f2a8d14..447195d 100644 (file)
@@ -2254,7 +2254,7 @@ int ll_getattr_it(struct vfsmount *mnt, struct dentry *de,
                 return res;
 
         stat->dev = inode->i_sb->s_dev;
-        if (cfs_curproc_is_32bit())
+        if (ll_need_32bit_api(ll_i2sbi(inode)))
                 stat->ino = cl_fid_build_ino32(&lli->lli_fid);
         else
                 stat->ino = inode->i_ino;
index b8788d2..691b505 100644 (file)
@@ -312,6 +312,7 @@ enum stats_track_type {
 #define LL_SBI_LRU_RESIZE       0x400 /* lru resize support */
 #define LL_SBI_LAZYSTATFS       0x800 /* lazystatfs mount option */
 #define LL_SBI_SOM_PREVIEW      0x1000 /* SOM preview mount option */
+#define LL_SBI_32BIT_API        0x2000 /* generate 32 bit inodes. */
 
 /* default value for ll_sb_info->contention_time */
 #define SBI_DEFAULT_CONTENTION_SECONDS     60
@@ -537,6 +538,15 @@ struct it_cb_data {
 __u32 ll_i2suppgid(struct inode *i);
 void ll_i2gids(__u32 *suppgids, struct inode *i1,struct inode *i2);
 
+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
+}
+
 #define LLAP_MAGIC 98764321
 
 extern cfs_mem_cache_t *ll_async_page_slab;
index b395e2b..486905e 100644 (file)
@@ -771,6 +771,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);