diff options
Diffstat (limited to 'fs/ceph')
-rw-r--r-- | fs/ceph/debugfs.c | 6 | ||||
-rw-r--r-- | fs/ceph/dir.c | 24 | ||||
-rw-r--r-- | fs/ceph/file.c | 10 | ||||
-rw-r--r-- | fs/ceph/inode.c | 25 | ||||
-rw-r--r-- | fs/ceph/super.c | 9 | ||||
-rw-r--r-- | fs/ceph/super.h | 66 |
6 files changed, 91 insertions, 49 deletions
diff --git a/fs/ceph/debugfs.c b/fs/ceph/debugfs.c index 08f65faac112..0dba6915712b 100644 --- a/fs/ceph/debugfs.c +++ b/fs/ceph/debugfs.c | |||
@@ -210,8 +210,6 @@ int ceph_fs_debugfs_init(struct ceph_fs_client *fsc) | |||
210 | if (!fsc->debugfs_congestion_kb) | 210 | if (!fsc->debugfs_congestion_kb) |
211 | goto out; | 211 | goto out; |
212 | 212 | ||
213 | dout("a\n"); | ||
214 | |||
215 | snprintf(name, sizeof(name), "../../bdi/%s", | 213 | snprintf(name, sizeof(name), "../../bdi/%s", |
216 | dev_name(fsc->backing_dev_info.dev)); | 214 | dev_name(fsc->backing_dev_info.dev)); |
217 | fsc->debugfs_bdi = | 215 | fsc->debugfs_bdi = |
@@ -221,7 +219,6 @@ int ceph_fs_debugfs_init(struct ceph_fs_client *fsc) | |||
221 | if (!fsc->debugfs_bdi) | 219 | if (!fsc->debugfs_bdi) |
222 | goto out; | 220 | goto out; |
223 | 221 | ||
224 | dout("b\n"); | ||
225 | fsc->debugfs_mdsmap = debugfs_create_file("mdsmap", | 222 | fsc->debugfs_mdsmap = debugfs_create_file("mdsmap", |
226 | 0600, | 223 | 0600, |
227 | fsc->client->debugfs_dir, | 224 | fsc->client->debugfs_dir, |
@@ -230,7 +227,6 @@ int ceph_fs_debugfs_init(struct ceph_fs_client *fsc) | |||
230 | if (!fsc->debugfs_mdsmap) | 227 | if (!fsc->debugfs_mdsmap) |
231 | goto out; | 228 | goto out; |
232 | 229 | ||
233 | dout("ca\n"); | ||
234 | fsc->debugfs_mdsc = debugfs_create_file("mdsc", | 230 | fsc->debugfs_mdsc = debugfs_create_file("mdsc", |
235 | 0600, | 231 | 0600, |
236 | fsc->client->debugfs_dir, | 232 | fsc->client->debugfs_dir, |
@@ -239,7 +235,6 @@ int ceph_fs_debugfs_init(struct ceph_fs_client *fsc) | |||
239 | if (!fsc->debugfs_mdsc) | 235 | if (!fsc->debugfs_mdsc) |
240 | goto out; | 236 | goto out; |
241 | 237 | ||
242 | dout("da\n"); | ||
243 | fsc->debugfs_caps = debugfs_create_file("caps", | 238 | fsc->debugfs_caps = debugfs_create_file("caps", |
244 | 0400, | 239 | 0400, |
245 | fsc->client->debugfs_dir, | 240 | fsc->client->debugfs_dir, |
@@ -248,7 +243,6 @@ int ceph_fs_debugfs_init(struct ceph_fs_client *fsc) | |||
248 | if (!fsc->debugfs_caps) | 243 | if (!fsc->debugfs_caps) |
249 | goto out; | 244 | goto out; |
250 | 245 | ||
251 | dout("ea\n"); | ||
252 | fsc->debugfs_dentry_lru = debugfs_create_file("dentry_lru", | 246 | fsc->debugfs_dentry_lru = debugfs_create_file("dentry_lru", |
253 | 0600, | 247 | 0600, |
254 | fsc->client->debugfs_dir, | 248 | fsc->client->debugfs_dir, |
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index ebafa65a29b6..1a867a3601ae 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c | |||
@@ -161,7 +161,7 @@ more: | |||
161 | filp->f_pos = di->offset; | 161 | filp->f_pos = di->offset; |
162 | err = filldir(dirent, dentry->d_name.name, | 162 | err = filldir(dirent, dentry->d_name.name, |
163 | dentry->d_name.len, di->offset, | 163 | dentry->d_name.len, di->offset, |
164 | dentry->d_inode->i_ino, | 164 | ceph_translate_ino(dentry->d_sb, dentry->d_inode->i_ino), |
165 | dentry->d_inode->i_mode >> 12); | 165 | dentry->d_inode->i_mode >> 12); |
166 | 166 | ||
167 | if (last) { | 167 | if (last) { |
@@ -245,15 +245,17 @@ static int ceph_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
245 | 245 | ||
246 | dout("readdir off 0 -> '.'\n"); | 246 | dout("readdir off 0 -> '.'\n"); |
247 | if (filldir(dirent, ".", 1, ceph_make_fpos(0, 0), | 247 | if (filldir(dirent, ".", 1, ceph_make_fpos(0, 0), |
248 | inode->i_ino, inode->i_mode >> 12) < 0) | 248 | ceph_translate_ino(inode->i_sb, inode->i_ino), |
249 | inode->i_mode >> 12) < 0) | ||
249 | return 0; | 250 | return 0; |
250 | filp->f_pos = 1; | 251 | filp->f_pos = 1; |
251 | off = 1; | 252 | off = 1; |
252 | } | 253 | } |
253 | if (filp->f_pos == 1) { | 254 | if (filp->f_pos == 1) { |
255 | ino_t ino = filp->f_dentry->d_parent->d_inode->i_ino; | ||
254 | dout("readdir off 1 -> '..'\n"); | 256 | dout("readdir off 1 -> '..'\n"); |
255 | if (filldir(dirent, "..", 2, ceph_make_fpos(0, 1), | 257 | if (filldir(dirent, "..", 2, ceph_make_fpos(0, 1), |
256 | filp->f_dentry->d_parent->d_inode->i_ino, | 258 | ceph_translate_ino(inode->i_sb, ino), |
257 | inode->i_mode >> 12) < 0) | 259 | inode->i_mode >> 12) < 0) |
258 | return 0; | 260 | return 0; |
259 | filp->f_pos = 2; | 261 | filp->f_pos = 2; |
@@ -377,7 +379,8 @@ more: | |||
377 | if (filldir(dirent, | 379 | if (filldir(dirent, |
378 | rinfo->dir_dname[off - fi->offset], | 380 | rinfo->dir_dname[off - fi->offset], |
379 | rinfo->dir_dname_len[off - fi->offset], | 381 | rinfo->dir_dname_len[off - fi->offset], |
380 | pos, ino, ftype) < 0) { | 382 | pos, |
383 | ceph_translate_ino(inode->i_sb, ino), ftype) < 0) { | ||
381 | dout("filldir stopping us...\n"); | 384 | dout("filldir stopping us...\n"); |
382 | return 0; | 385 | return 0; |
383 | } | 386 | } |
@@ -1024,14 +1027,13 @@ out_touch: | |||
1024 | } | 1027 | } |
1025 | 1028 | ||
1026 | /* | 1029 | /* |
1027 | * When a dentry is released, clear the dir I_COMPLETE if it was part | 1030 | * Release our ceph_dentry_info. |
1028 | * of the current dir gen or if this is in the snapshot namespace. | ||
1029 | */ | 1031 | */ |
1030 | static void ceph_dentry_release(struct dentry *dentry) | 1032 | static void ceph_d_release(struct dentry *dentry) |
1031 | { | 1033 | { |
1032 | struct ceph_dentry_info *di = ceph_dentry(dentry); | 1034 | struct ceph_dentry_info *di = ceph_dentry(dentry); |
1033 | 1035 | ||
1034 | dout("dentry_release %p\n", dentry); | 1036 | dout("d_release %p\n", dentry); |
1035 | if (di) { | 1037 | if (di) { |
1036 | ceph_dentry_lru_del(dentry); | 1038 | ceph_dentry_lru_del(dentry); |
1037 | if (di->lease_session) | 1039 | if (di->lease_session) |
@@ -1256,14 +1258,14 @@ const struct inode_operations ceph_dir_iops = { | |||
1256 | 1258 | ||
1257 | const struct dentry_operations ceph_dentry_ops = { | 1259 | const struct dentry_operations ceph_dentry_ops = { |
1258 | .d_revalidate = ceph_d_revalidate, | 1260 | .d_revalidate = ceph_d_revalidate, |
1259 | .d_release = ceph_dentry_release, | 1261 | .d_release = ceph_d_release, |
1260 | }; | 1262 | }; |
1261 | 1263 | ||
1262 | const struct dentry_operations ceph_snapdir_dentry_ops = { | 1264 | const struct dentry_operations ceph_snapdir_dentry_ops = { |
1263 | .d_revalidate = ceph_snapdir_d_revalidate, | 1265 | .d_revalidate = ceph_snapdir_d_revalidate, |
1264 | .d_release = ceph_dentry_release, | 1266 | .d_release = ceph_d_release, |
1265 | }; | 1267 | }; |
1266 | 1268 | ||
1267 | const struct dentry_operations ceph_snap_dentry_ops = { | 1269 | const struct dentry_operations ceph_snap_dentry_ops = { |
1268 | .d_release = ceph_dentry_release, | 1270 | .d_release = ceph_d_release, |
1269 | }; | 1271 | }; |
diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 7d0e4a82d898..159b512d5a27 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c | |||
@@ -564,11 +564,19 @@ more: | |||
564 | * start_request so that a tid has been assigned. | 564 | * start_request so that a tid has been assigned. |
565 | */ | 565 | */ |
566 | spin_lock(&ci->i_unsafe_lock); | 566 | spin_lock(&ci->i_unsafe_lock); |
567 | list_add(&req->r_unsafe_item, &ci->i_unsafe_writes); | 567 | list_add_tail(&req->r_unsafe_item, |
568 | &ci->i_unsafe_writes); | ||
568 | spin_unlock(&ci->i_unsafe_lock); | 569 | spin_unlock(&ci->i_unsafe_lock); |
569 | ceph_get_cap_refs(ci, CEPH_CAP_FILE_WR); | 570 | ceph_get_cap_refs(ci, CEPH_CAP_FILE_WR); |
570 | } | 571 | } |
572 | |||
571 | ret = ceph_osdc_wait_request(&fsc->client->osdc, req); | 573 | ret = ceph_osdc_wait_request(&fsc->client->osdc, req); |
574 | if (ret < 0 && req->r_safe_callback) { | ||
575 | spin_lock(&ci->i_unsafe_lock); | ||
576 | list_del_init(&req->r_unsafe_item); | ||
577 | spin_unlock(&ci->i_unsafe_lock); | ||
578 | ceph_put_cap_refs(ci, CEPH_CAP_FILE_WR); | ||
579 | } | ||
572 | } | 580 | } |
573 | 581 | ||
574 | if (file->f_flags & O_DIRECT) | 582 | if (file->f_flags & O_DIRECT) |
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 193bfa5e9cbd..b54c97da1c43 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c | |||
@@ -36,6 +36,13 @@ static void ceph_vmtruncate_work(struct work_struct *work); | |||
36 | /* | 36 | /* |
37 | * find or create an inode, given the ceph ino number | 37 | * find or create an inode, given the ceph ino number |
38 | */ | 38 | */ |
39 | static int ceph_set_ino_cb(struct inode *inode, void *data) | ||
40 | { | ||
41 | ceph_inode(inode)->i_vino = *(struct ceph_vino *)data; | ||
42 | inode->i_ino = ceph_vino_to_ino(*(struct ceph_vino *)data); | ||
43 | return 0; | ||
44 | } | ||
45 | |||
39 | struct inode *ceph_get_inode(struct super_block *sb, struct ceph_vino vino) | 46 | struct inode *ceph_get_inode(struct super_block *sb, struct ceph_vino vino) |
40 | { | 47 | { |
41 | struct inode *inode; | 48 | struct inode *inode; |
@@ -1030,9 +1037,6 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req, | |||
1030 | dout("fill_trace doing d_move %p -> %p\n", | 1037 | dout("fill_trace doing d_move %p -> %p\n", |
1031 | req->r_old_dentry, dn); | 1038 | req->r_old_dentry, dn); |
1032 | 1039 | ||
1033 | /* d_move screws up d_subdirs order */ | ||
1034 | ceph_i_clear(dir, CEPH_I_COMPLETE); | ||
1035 | |||
1036 | d_move(req->r_old_dentry, dn); | 1040 | d_move(req->r_old_dentry, dn); |
1037 | dout(" src %p '%.*s' dst %p '%.*s'\n", | 1041 | dout(" src %p '%.*s' dst %p '%.*s'\n", |
1038 | req->r_old_dentry, | 1042 | req->r_old_dentry, |
@@ -1044,12 +1048,15 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req, | |||
1044 | rehashing bug in vfs_rename_dir */ | 1048 | rehashing bug in vfs_rename_dir */ |
1045 | ceph_invalidate_dentry_lease(dn); | 1049 | ceph_invalidate_dentry_lease(dn); |
1046 | 1050 | ||
1047 | /* take overwritten dentry's readdir offset */ | 1051 | /* |
1048 | dout("dn %p gets %p offset %lld (old offset %lld)\n", | 1052 | * d_move() puts the renamed dentry at the end of |
1049 | req->r_old_dentry, dn, ceph_dentry(dn)->offset, | 1053 | * d_subdirs. We need to assign it an appropriate |
1054 | * directory offset so we can behave when holding | ||
1055 | * I_COMPLETE. | ||
1056 | */ | ||
1057 | ceph_set_dentry_offset(req->r_old_dentry); | ||
1058 | dout("dn %p gets new offset %lld\n", req->r_old_dentry, | ||
1050 | ceph_dentry(req->r_old_dentry)->offset); | 1059 | ceph_dentry(req->r_old_dentry)->offset); |
1051 | ceph_dentry(req->r_old_dentry)->offset = | ||
1052 | ceph_dentry(dn)->offset; | ||
1053 | 1060 | ||
1054 | dn = req->r_old_dentry; /* use old_dentry */ | 1061 | dn = req->r_old_dentry; /* use old_dentry */ |
1055 | in = dn->d_inode; | 1062 | in = dn->d_inode; |
@@ -1809,7 +1816,7 @@ int ceph_getattr(struct vfsmount *mnt, struct dentry *dentry, | |||
1809 | err = ceph_do_getattr(inode, CEPH_STAT_CAP_INODE_ALL); | 1816 | err = ceph_do_getattr(inode, CEPH_STAT_CAP_INODE_ALL); |
1810 | if (!err) { | 1817 | if (!err) { |
1811 | generic_fillattr(inode, stat); | 1818 | generic_fillattr(inode, stat); |
1812 | stat->ino = inode->i_ino; | 1819 | stat->ino = ceph_translate_ino(inode->i_sb, inode->i_ino); |
1813 | if (ceph_snap(inode) != CEPH_NOSNAP) | 1820 | if (ceph_snap(inode) != CEPH_NOSNAP) |
1814 | stat->dev = ceph_snap(inode); | 1821 | stat->dev = ceph_snap(inode); |
1815 | else | 1822 | else |
diff --git a/fs/ceph/super.c b/fs/ceph/super.c index 9c5085465a63..a9e78b4a258c 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c | |||
@@ -131,6 +131,7 @@ enum { | |||
131 | Opt_rbytes, | 131 | Opt_rbytes, |
132 | Opt_norbytes, | 132 | Opt_norbytes, |
133 | Opt_noasyncreaddir, | 133 | Opt_noasyncreaddir, |
134 | Opt_ino32, | ||
134 | }; | 135 | }; |
135 | 136 | ||
136 | static match_table_t fsopt_tokens = { | 137 | static match_table_t fsopt_tokens = { |
@@ -150,6 +151,7 @@ static match_table_t fsopt_tokens = { | |||
150 | {Opt_rbytes, "rbytes"}, | 151 | {Opt_rbytes, "rbytes"}, |
151 | {Opt_norbytes, "norbytes"}, | 152 | {Opt_norbytes, "norbytes"}, |
152 | {Opt_noasyncreaddir, "noasyncreaddir"}, | 153 | {Opt_noasyncreaddir, "noasyncreaddir"}, |
154 | {Opt_ino32, "ino32"}, | ||
153 | {-1, NULL} | 155 | {-1, NULL} |
154 | }; | 156 | }; |
155 | 157 | ||
@@ -225,6 +227,9 @@ static int parse_fsopt_token(char *c, void *private) | |||
225 | case Opt_noasyncreaddir: | 227 | case Opt_noasyncreaddir: |
226 | fsopt->flags |= CEPH_MOUNT_OPT_NOASYNCREADDIR; | 228 | fsopt->flags |= CEPH_MOUNT_OPT_NOASYNCREADDIR; |
227 | break; | 229 | break; |
230 | case Opt_ino32: | ||
231 | fsopt->flags |= CEPH_MOUNT_OPT_INO32; | ||
232 | break; | ||
228 | default: | 233 | default: |
229 | BUG_ON(token); | 234 | BUG_ON(token); |
230 | } | 235 | } |
@@ -288,7 +293,7 @@ static int parse_mount_options(struct ceph_mount_options **pfsopt, | |||
288 | fsopt->sb_flags = flags; | 293 | fsopt->sb_flags = flags; |
289 | fsopt->flags = CEPH_MOUNT_OPT_DEFAULT; | 294 | fsopt->flags = CEPH_MOUNT_OPT_DEFAULT; |
290 | 295 | ||
291 | fsopt->rsize = CEPH_MOUNT_RSIZE_DEFAULT; | 296 | fsopt->rsize = CEPH_RSIZE_DEFAULT; |
292 | fsopt->snapdir_name = kstrdup(CEPH_SNAPDIRNAME_DEFAULT, GFP_KERNEL); | 297 | fsopt->snapdir_name = kstrdup(CEPH_SNAPDIRNAME_DEFAULT, GFP_KERNEL); |
293 | fsopt->caps_wanted_delay_min = CEPH_CAPS_WANTED_DELAY_MIN_DEFAULT; | 298 | fsopt->caps_wanted_delay_min = CEPH_CAPS_WANTED_DELAY_MIN_DEFAULT; |
294 | fsopt->caps_wanted_delay_max = CEPH_CAPS_WANTED_DELAY_MAX_DEFAULT; | 299 | fsopt->caps_wanted_delay_max = CEPH_CAPS_WANTED_DELAY_MAX_DEFAULT; |
@@ -370,7 +375,7 @@ static int ceph_show_options(struct seq_file *m, struct vfsmount *mnt) | |||
370 | 375 | ||
371 | if (fsopt->wsize) | 376 | if (fsopt->wsize) |
372 | seq_printf(m, ",wsize=%d", fsopt->wsize); | 377 | seq_printf(m, ",wsize=%d", fsopt->wsize); |
373 | if (fsopt->rsize != CEPH_MOUNT_RSIZE_DEFAULT) | 378 | if (fsopt->rsize != CEPH_RSIZE_DEFAULT) |
374 | seq_printf(m, ",rsize=%d", fsopt->rsize); | 379 | seq_printf(m, ",rsize=%d", fsopt->rsize); |
375 | if (fsopt->congestion_kb != default_congestion_kb()) | 380 | if (fsopt->congestion_kb != default_congestion_kb()) |
376 | seq_printf(m, ",write_congestion_kb=%d", fsopt->congestion_kb); | 381 | seq_printf(m, ",write_congestion_kb=%d", fsopt->congestion_kb); |
diff --git a/fs/ceph/super.h b/fs/ceph/super.h index 20b907d76ae2..619fe719968f 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 | ||
@@ -35,6 +36,7 @@ | |||
35 | #define ceph_test_mount_opt(fsc, opt) \ | 36 | #define ceph_test_mount_opt(fsc, opt) \ |
36 | (!!((fsc)->mount_options->flags & CEPH_MOUNT_OPT_##opt)) | 37 | (!!((fsc)->mount_options->flags & CEPH_MOUNT_OPT_##opt)) |
37 | 38 | ||
39 | #define CEPH_RSIZE_DEFAULT (512*1024) /* readahead */ | ||
38 | #define CEPH_MAX_READDIR_DEFAULT 1024 | 40 | #define CEPH_MAX_READDIR_DEFAULT 1024 |
39 | #define CEPH_MAX_READDIR_BYTES_DEFAULT (512*1024) | 41 | #define CEPH_MAX_READDIR_BYTES_DEFAULT (512*1024) |
40 | #define CEPH_SNAPDIRNAME_DEFAULT ".snap" | 42 | #define CEPH_SNAPDIRNAME_DEFAULT ".snap" |
@@ -319,6 +321,16 @@ static inline struct ceph_inode_info *ceph_inode(struct inode *inode) | |||
319 | return container_of(inode, struct ceph_inode_info, vfs_inode); | 321 | return container_of(inode, struct ceph_inode_info, vfs_inode); |
320 | } | 322 | } |
321 | 323 | ||
324 | static inline struct ceph_fs_client *ceph_inode_to_client(struct inode *inode) | ||
325 | { | ||
326 | return (struct ceph_fs_client *)inode->i_sb->s_fs_info; | ||
327 | } | ||
328 | |||
329 | static inline struct ceph_fs_client *ceph_sb_to_client(struct super_block *sb) | ||
330 | { | ||
331 | return (struct ceph_fs_client *)sb->s_fs_info; | ||
332 | } | ||
333 | |||
322 | static inline struct ceph_vino ceph_vino(struct inode *inode) | 334 | static inline struct ceph_vino ceph_vino(struct inode *inode) |
323 | { | 335 | { |
324 | return ceph_inode(inode)->i_vino; | 336 | return ceph_inode(inode)->i_vino; |
@@ -327,19 +339,49 @@ static inline struct ceph_vino ceph_vino(struct inode *inode) | |||
327 | /* | 339 | /* |
328 | * ino_t is <64 bits on many architectures, blech. | 340 | * ino_t is <64 bits on many architectures, blech. |
329 | * | 341 | * |
330 | * don't include snap in ino hash, at least for now. | 342 | * i_ino (kernel inode) st_ino (userspace) |
343 | * i386 32 32 | ||
344 | * x86_64+ino32 64 32 | ||
345 | * x86_64 64 64 | ||
346 | */ | ||
347 | static inline u32 ceph_ino_to_ino32(ino_t ino) | ||
348 | { | ||
349 | ino ^= ino >> (sizeof(ino) * 8 - 32); | ||
350 | if (!ino) | ||
351 | ino = 1; | ||
352 | return ino; | ||
353 | } | ||
354 | |||
355 | /* | ||
356 | * kernel i_ino value | ||
331 | */ | 357 | */ |
332 | static inline ino_t ceph_vino_to_ino(struct ceph_vino vino) | 358 | static inline ino_t ceph_vino_to_ino(struct ceph_vino vino) |
333 | { | 359 | { |
334 | ino_t ino = (ino_t)vino.ino; /* ^ (vino.snap << 20); */ | 360 | ino_t ino = (ino_t)vino.ino; /* ^ (vino.snap << 20); */ |
335 | #if BITS_PER_LONG == 32 | 361 | #if BITS_PER_LONG == 32 |
336 | ino ^= vino.ino >> (sizeof(u64)-sizeof(ino_t)) * 8; | 362 | ino = ceph_ino_to_ino32(ino); |
337 | if (!ino) | ||
338 | ino = 1; | ||
339 | #endif | 363 | #endif |
340 | return ino; | 364 | return ino; |
341 | } | 365 | } |
342 | 366 | ||
367 | /* | ||
368 | * user-visible ino (stat, filldir) | ||
369 | */ | ||
370 | #if BITS_PER_LONG == 32 | ||
371 | static inline ino_t ceph_translate_ino(struct super_block *sb, ino_t ino) | ||
372 | { | ||
373 | return ino; | ||
374 | } | ||
375 | #else | ||
376 | static inline ino_t ceph_translate_ino(struct super_block *sb, ino_t ino) | ||
377 | { | ||
378 | if (ceph_test_mount_opt(ceph_sb_to_client(sb), INO32)) | ||
379 | ino = ceph_ino_to_ino32(ino); | ||
380 | return ino; | ||
381 | } | ||
382 | #endif | ||
383 | |||
384 | |||
343 | /* for printf-style formatting */ | 385 | /* for printf-style formatting */ |
344 | #define ceph_vinop(i) ceph_inode(i)->i_vino.ino, ceph_inode(i)->i_vino.snap | 386 | #define ceph_vinop(i) ceph_inode(i)->i_vino.ino, ceph_inode(i)->i_vino.snap |
345 | 387 | ||
@@ -428,13 +470,6 @@ static inline loff_t ceph_make_fpos(unsigned frag, unsigned off) | |||
428 | return ((loff_t)frag << 32) | (loff_t)off; | 470 | return ((loff_t)frag << 32) | (loff_t)off; |
429 | } | 471 | } |
430 | 472 | ||
431 | static 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 | /* | 473 | /* |
439 | * caps helpers | 474 | * caps helpers |
440 | */ | 475 | */ |
@@ -503,15 +538,6 @@ extern void ceph_reservation_status(struct ceph_fs_client *client, | |||
503 | int *total, int *avail, int *used, | 538 | int *total, int *avail, int *used, |
504 | int *reserved, int *min); | 539 | int *reserved, int *min); |
505 | 540 | ||
506 | static 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 | |||
511 | static 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 | 541 | ||
516 | 542 | ||
517 | /* | 543 | /* |