From 3b13fbcaa247cde14ef60944fb019208141e9b7a Mon Sep 17 00:00:00 2001 From: pravin Date: Wed, 25 Aug 2010 17:20:43 +0530 Subject: [PATCH] b=20563 add llite mount option to generate 32bit ino v2 i=vitaly i=andreas patch adds mount option to generate 32bit ino, this can be used for 32bit application compatibility. --- lustre/llite/dir.c | 11 +++++++---- lustre/llite/llite_internal.h | 10 ++++++++++ lustre/llite/llite_lib.c | 5 +++++ 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/lustre/llite/dir.c b/lustre/llite/dir.c index 1160fa8..7a40543 100644 --- a/lustre/llite/dir.c +++ b/lustre/llite/dir.c @@ -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); diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index 17897b1..0599a3e 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -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 */ diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index c3ca662..cdd958f 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -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); -- 1.8.3.1