aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/super.h
diff options
context:
space:
mode:
authorYehuda Sadeh <yehuda@hq.newdream.net>2011-01-21 19:44:03 -0500
committerSage Weil <sage@newdream.net>2011-03-21 15:24:22 -0400
commitad1fee96cbaf873520064252c5dc3212c9844861 (patch)
treebce9fcd824af836279a6dd10007430cc3872cb3a /fs/ceph/super.h
parent483fac71485e5063ff4033b6dc7d91567f1b6ff1 (diff)
ceph: add ino32 mount option
The ino32 mount option forces the ceph fs to report 32 bit ino values. This is useful for 64 bit kernels with 32 bit userspace. Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net>
Diffstat (limited to 'fs/ceph/super.h')
-rw-r--r--fs/ceph/super.h65
1 files changed, 45 insertions, 20 deletions
diff --git a/fs/ceph/super.h b/fs/ceph/super.h
index 20b907d76ae2..5405c903704e 100644
--- a/fs/ceph/super.h
+++ b/fs/ceph/super.h
@@ -27,6 +27,7 @@
27#define CEPH_MOUNT_OPT_DIRSTAT (1<<4) /* `cat dirname` for stats */ 27#define CEPH_MOUNT_OPT_DIRSTAT (1<<4) /* `cat dirname` for stats */
28#define CEPH_MOUNT_OPT_RBYTES (1<<5) /* dir st_bytes = rbytes */ 28#define CEPH_MOUNT_OPT_RBYTES (1<<5) /* dir st_bytes = rbytes */
29#define CEPH_MOUNT_OPT_NOASYNCREADDIR (1<<7) /* no dcache readdir */ 29#define CEPH_MOUNT_OPT_NOASYNCREADDIR (1<<7) /* no dcache readdir */
30#define CEPH_MOUNT_OPT_INO32 (1<<8) /* 32 bit inos */
30 31
31#define CEPH_MOUNT_OPT_DEFAULT (CEPH_MOUNT_OPT_RBYTES) 32#define CEPH_MOUNT_OPT_DEFAULT (CEPH_MOUNT_OPT_RBYTES)
32 33
@@ -319,6 +320,16 @@ static inline struct ceph_inode_info *ceph_inode(struct inode *inode)
319 return container_of(inode, struct ceph_inode_info, vfs_inode); 320 return container_of(inode, struct ceph_inode_info, vfs_inode);
320} 321}
321 322
323static inline struct ceph_fs_client *ceph_inode_to_client(struct inode *inode)
324{
325 return (struct ceph_fs_client *)inode->i_sb->s_fs_info;
326}
327
328static inline struct ceph_fs_client *ceph_sb_to_client(struct super_block *sb)
329{
330 return (struct ceph_fs_client *)sb->s_fs_info;
331}
332
322static inline struct ceph_vino ceph_vino(struct inode *inode) 333static inline struct ceph_vino ceph_vino(struct inode *inode)
323{ 334{
324 return ceph_inode(inode)->i_vino; 335 return ceph_inode(inode)->i_vino;
@@ -327,19 +338,49 @@ static inline struct ceph_vino ceph_vino(struct inode *inode)
327/* 338/*
328 * ino_t is <64 bits on many architectures, blech. 339 * ino_t is <64 bits on many architectures, blech.
329 * 340 *
330 * don't include snap in ino hash, at least for now. 341 * i_ino (kernel inode) st_ino (userspace)
342 * i386 32 32
343 * x86_64+ino32 64 32
344 * x86_64 64 64
345 */
346static inline u32 ceph_ino_to_ino32(ino_t ino)
347{
348 ino ^= ino >> (sizeof(ino) * 8 - 32);
349 if (!ino)
350 ino = 1;
351 return ino;
352}
353
354/*
355 * kernel i_ino value
331 */ 356 */
332static inline ino_t ceph_vino_to_ino(struct ceph_vino vino) 357static inline ino_t ceph_vino_to_ino(struct ceph_vino vino)
333{ 358{
334 ino_t ino = (ino_t)vino.ino; /* ^ (vino.snap << 20); */ 359 ino_t ino = (ino_t)vino.ino; /* ^ (vino.snap << 20); */
335#if BITS_PER_LONG == 32 360#if BITS_PER_LONG == 32
336 ino ^= vino.ino >> (sizeof(u64)-sizeof(ino_t)) * 8; 361 ino = ceph_ino_to_ino32(ino);
337 if (!ino)
338 ino = 1;
339#endif 362#endif
340 return ino; 363 return ino;
341} 364}
342 365
366/*
367 * user-visible ino (stat, filldir)
368 */
369#if BITS_PER_LONG == 32
370static inline ino_t ceph_translate_ino(struct super_block *sb, ino_t ino)
371{
372 return ino;
373}
374#else
375static inline ino_t ceph_translate_ino(struct super_block *sb, ino_t ino)
376{
377 if (ceph_test_mount_opt(ceph_sb_to_client(sb), INO32))
378 ino = ceph_ino_to_ino32(ino);
379 return ino;
380}
381#endif
382
383
343/* for printf-style formatting */ 384/* for printf-style formatting */
344#define ceph_vinop(i) ceph_inode(i)->i_vino.ino, ceph_inode(i)->i_vino.snap 385#define ceph_vinop(i) ceph_inode(i)->i_vino.ino, ceph_inode(i)->i_vino.snap
345 386
@@ -428,13 +469,6 @@ static inline loff_t ceph_make_fpos(unsigned frag, unsigned off)
428 return ((loff_t)frag << 32) | (loff_t)off; 469 return ((loff_t)frag << 32) | (loff_t)off;
429} 470}
430 471
431static inline int ceph_set_ino_cb(struct inode *inode, void *data)
432{
433 ceph_inode(inode)->i_vino = *(struct ceph_vino *)data;
434 inode->i_ino = ceph_vino_to_ino(*(struct ceph_vino *)data);
435 return 0;
436}
437
438/* 472/*
439 * caps helpers 473 * caps helpers
440 */ 474 */
@@ -503,15 +537,6 @@ extern void ceph_reservation_status(struct ceph_fs_client *client,
503 int *total, int *avail, int *used, 537 int *total, int *avail, int *used,
504 int *reserved, int *min); 538 int *reserved, int *min);
505 539
506static inline struct ceph_fs_client *ceph_inode_to_client(struct inode *inode)
507{
508 return (struct ceph_fs_client *)inode->i_sb->s_fs_info;
509}
510
511static inline struct ceph_fs_client *ceph_sb_to_client(struct super_block *sb)
512{
513 return (struct ceph_fs_client *)sb->s_fs_info;
514}
515 540
516 541
517/* 542/*