diff options
Diffstat (limited to 'fs/ceph/super.h')
-rw-r--r-- | fs/ceph/super.h | 397 |
1 files changed, 143 insertions, 254 deletions
diff --git a/fs/ceph/super.h b/fs/ceph/super.h index b87638e84c4..e2e904442ce 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h | |||
@@ -1,7 +1,7 @@ | |||
1 | #ifndef _FS_CEPH_SUPER_H | 1 | #ifndef _FS_CEPH_SUPER_H |
2 | #define _FS_CEPH_SUPER_H | 2 | #define _FS_CEPH_SUPER_H |
3 | 3 | ||
4 | #include "ceph_debug.h" | 4 | #include <linux/ceph/ceph_debug.h> |
5 | 5 | ||
6 | #include <asm/unaligned.h> | 6 | #include <asm/unaligned.h> |
7 | #include <linux/backing-dev.h> | 7 | #include <linux/backing-dev.h> |
@@ -14,13 +14,7 @@ | |||
14 | #include <linux/writeback.h> | 14 | #include <linux/writeback.h> |
15 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
16 | 16 | ||
17 | #include "types.h" | 17 | #include <linux/ceph/libceph.h> |
18 | #include "messenger.h" | ||
19 | #include "msgpool.h" | ||
20 | #include "mon_client.h" | ||
21 | #include "mds_client.h" | ||
22 | #include "osd_client.h" | ||
23 | #include "ceph_fs.h" | ||
24 | 18 | ||
25 | /* f_type in struct statfs */ | 19 | /* f_type in struct statfs */ |
26 | #define CEPH_SUPER_MAGIC 0x00c36400 | 20 | #define CEPH_SUPER_MAGIC 0x00c36400 |
@@ -30,42 +24,25 @@ | |||
30 | #define CEPH_BLOCK_SHIFT 20 /* 1 MB */ | 24 | #define CEPH_BLOCK_SHIFT 20 /* 1 MB */ |
31 | #define CEPH_BLOCK (1 << CEPH_BLOCK_SHIFT) | 25 | #define CEPH_BLOCK (1 << CEPH_BLOCK_SHIFT) |
32 | 26 | ||
33 | /* | 27 | #define CEPH_MOUNT_OPT_DIRSTAT (1<<4) /* `cat dirname` for stats */ |
34 | * Supported features | 28 | #define CEPH_MOUNT_OPT_RBYTES (1<<5) /* dir st_bytes = rbytes */ |
35 | */ | 29 | #define CEPH_MOUNT_OPT_NOASYNCREADDIR (1<<7) /* no dcache readdir */ |
36 | #define CEPH_FEATURE_SUPPORTED CEPH_FEATURE_NOSRCADDR | CEPH_FEATURE_FLOCK | ||
37 | #define CEPH_FEATURE_REQUIRED CEPH_FEATURE_NOSRCADDR | ||
38 | 30 | ||
39 | /* | 31 | #define CEPH_MOUNT_OPT_DEFAULT (CEPH_MOUNT_OPT_RBYTES) |
40 | * mount options | ||
41 | */ | ||
42 | #define CEPH_OPT_FSID (1<<0) | ||
43 | #define CEPH_OPT_NOSHARE (1<<1) /* don't share client with other sbs */ | ||
44 | #define CEPH_OPT_MYIP (1<<2) /* specified my ip */ | ||
45 | #define CEPH_OPT_DIRSTAT (1<<4) /* funky `cat dirname` for stats */ | ||
46 | #define CEPH_OPT_RBYTES (1<<5) /* dir st_bytes = rbytes */ | ||
47 | #define CEPH_OPT_NOCRC (1<<6) /* no data crc on writes */ | ||
48 | #define CEPH_OPT_NOASYNCREADDIR (1<<7) /* no dcache readdir */ | ||
49 | 32 | ||
50 | #define CEPH_OPT_DEFAULT (CEPH_OPT_RBYTES) | 33 | #define ceph_set_mount_opt(fsc, opt) \ |
34 | (fsc)->mount_options->flags |= CEPH_MOUNT_OPT_##opt; | ||
35 | #define ceph_test_mount_opt(fsc, opt) \ | ||
36 | (!!((fsc)->mount_options->flags & CEPH_MOUNT_OPT_##opt)) | ||
51 | 37 | ||
52 | #define ceph_set_opt(client, opt) \ | 38 | #define CEPH_MAX_READDIR_DEFAULT 1024 |
53 | (client)->mount_args->flags |= CEPH_OPT_##opt; | 39 | #define CEPH_MAX_READDIR_BYTES_DEFAULT (512*1024) |
54 | #define ceph_test_opt(client, opt) \ | 40 | #define CEPH_SNAPDIRNAME_DEFAULT ".snap" |
55 | (!!((client)->mount_args->flags & CEPH_OPT_##opt)) | ||
56 | 41 | ||
57 | 42 | struct ceph_mount_options { | |
58 | struct ceph_mount_args { | ||
59 | int sb_flags; | ||
60 | int flags; | 43 | int flags; |
61 | struct ceph_fsid fsid; | 44 | int sb_flags; |
62 | struct ceph_entity_addr my_addr; | 45 | |
63 | int num_mon; | ||
64 | struct ceph_entity_addr *mon_addr; | ||
65 | int mount_timeout; | ||
66 | int osd_idle_ttl; | ||
67 | int osd_timeout; | ||
68 | int osd_keepalive_timeout; | ||
69 | int wsize; | 46 | int wsize; |
70 | int rsize; /* max readahead */ | 47 | int rsize; /* max readahead */ |
71 | int congestion_kb; /* max writeback in flight */ | 48 | int congestion_kb; /* max writeback in flight */ |
@@ -73,82 +50,25 @@ struct ceph_mount_args { | |||
73 | int cap_release_safety; | 50 | int cap_release_safety; |
74 | int max_readdir; /* max readdir result (entires) */ | 51 | int max_readdir; /* max readdir result (entires) */ |
75 | int max_readdir_bytes; /* max readdir result (bytes) */ | 52 | int max_readdir_bytes; /* max readdir result (bytes) */ |
76 | char *snapdir_name; /* default ".snap" */ | ||
77 | char *name; | ||
78 | char *secret; | ||
79 | }; | ||
80 | |||
81 | /* | ||
82 | * defaults | ||
83 | */ | ||
84 | #define CEPH_MOUNT_TIMEOUT_DEFAULT 60 | ||
85 | #define CEPH_OSD_TIMEOUT_DEFAULT 60 /* seconds */ | ||
86 | #define CEPH_OSD_KEEPALIVE_DEFAULT 5 | ||
87 | #define CEPH_OSD_IDLE_TTL_DEFAULT 60 | ||
88 | #define CEPH_MOUNT_RSIZE_DEFAULT (512*1024) /* readahead */ | ||
89 | #define CEPH_MAX_READDIR_DEFAULT 1024 | ||
90 | #define CEPH_MAX_READDIR_BYTES_DEFAULT (512*1024) | ||
91 | |||
92 | #define CEPH_MSG_MAX_FRONT_LEN (16*1024*1024) | ||
93 | #define CEPH_MSG_MAX_DATA_LEN (16*1024*1024) | ||
94 | |||
95 | #define CEPH_SNAPDIRNAME_DEFAULT ".snap" | ||
96 | #define CEPH_AUTH_NAME_DEFAULT "guest" | ||
97 | /* | ||
98 | * Delay telling the MDS we no longer want caps, in case we reopen | ||
99 | * the file. Delay a minimum amount of time, even if we send a cap | ||
100 | * message for some other reason. Otherwise, take the oppotunity to | ||
101 | * update the mds to avoid sending another message later. | ||
102 | */ | ||
103 | #define CEPH_CAPS_WANTED_DELAY_MIN_DEFAULT 5 /* cap release delay */ | ||
104 | #define CEPH_CAPS_WANTED_DELAY_MAX_DEFAULT 60 /* cap release delay */ | ||
105 | |||
106 | #define CEPH_CAP_RELEASE_SAFETY_DEFAULT (CEPH_CAPS_PER_RELEASE * 4) | ||
107 | |||
108 | /* mount state */ | ||
109 | enum { | ||
110 | CEPH_MOUNT_MOUNTING, | ||
111 | CEPH_MOUNT_MOUNTED, | ||
112 | CEPH_MOUNT_UNMOUNTING, | ||
113 | CEPH_MOUNT_UNMOUNTED, | ||
114 | CEPH_MOUNT_SHUTDOWN, | ||
115 | }; | ||
116 | 53 | ||
117 | /* | 54 | /* |
118 | * subtract jiffies | 55 | * everything above this point can be memcmp'd; everything below |
119 | */ | 56 | * is handled in compare_mount_options() |
120 | static inline unsigned long time_sub(unsigned long a, unsigned long b) | 57 | */ |
121 | { | ||
122 | BUG_ON(time_after(b, a)); | ||
123 | return (long)a - (long)b; | ||
124 | } | ||
125 | |||
126 | /* | ||
127 | * per-filesystem client state | ||
128 | * | ||
129 | * possibly shared by multiple mount points, if they are | ||
130 | * mounting the same ceph filesystem/cluster. | ||
131 | */ | ||
132 | struct ceph_client { | ||
133 | struct ceph_fsid fsid; | ||
134 | bool have_fsid; | ||
135 | 58 | ||
136 | struct mutex mount_mutex; /* serialize mount attempts */ | 59 | char *snapdir_name; /* default ".snap" */ |
137 | struct ceph_mount_args *mount_args; | 60 | }; |
138 | 61 | ||
62 | struct ceph_fs_client { | ||
139 | struct super_block *sb; | 63 | struct super_block *sb; |
140 | 64 | ||
141 | unsigned long mount_state; | 65 | struct ceph_mount_options *mount_options; |
142 | wait_queue_head_t auth_wq; | 66 | struct ceph_client *client; |
143 | |||
144 | int auth_err; | ||
145 | 67 | ||
68 | unsigned long mount_state; | ||
146 | int min_caps; /* min caps i added */ | 69 | int min_caps; /* min caps i added */ |
147 | 70 | ||
148 | struct ceph_messenger *msgr; /* messenger instance */ | 71 | struct ceph_mds_client *mdsc; |
149 | struct ceph_mon_client monc; | ||
150 | struct ceph_mds_client mdsc; | ||
151 | struct ceph_osd_client osdc; | ||
152 | 72 | ||
153 | /* writeback */ | 73 | /* writeback */ |
154 | mempool_t *wb_pagevec_pool; | 74 | mempool_t *wb_pagevec_pool; |
@@ -160,14 +80,14 @@ struct ceph_client { | |||
160 | struct backing_dev_info backing_dev_info; | 80 | struct backing_dev_info backing_dev_info; |
161 | 81 | ||
162 | #ifdef CONFIG_DEBUG_FS | 82 | #ifdef CONFIG_DEBUG_FS |
163 | struct dentry *debugfs_monmap; | 83 | struct dentry *debugfs_dentry_lru, *debugfs_caps; |
164 | struct dentry *debugfs_mdsmap, *debugfs_osdmap; | ||
165 | struct dentry *debugfs_dir, *debugfs_dentry_lru, *debugfs_caps; | ||
166 | struct dentry *debugfs_congestion_kb; | 84 | struct dentry *debugfs_congestion_kb; |
167 | struct dentry *debugfs_bdi; | 85 | struct dentry *debugfs_bdi; |
86 | struct dentry *debugfs_mdsc, *debugfs_mdsmap; | ||
168 | #endif | 87 | #endif |
169 | }; | 88 | }; |
170 | 89 | ||
90 | |||
171 | /* | 91 | /* |
172 | * File i/o capability. This tracks shared state with the metadata | 92 | * File i/o capability. This tracks shared state with the metadata |
173 | * server that allows us to cache or writeback attributes or to read | 93 | * server that allows us to cache or writeback attributes or to read |
@@ -275,6 +195,20 @@ struct ceph_inode_xattr { | |||
275 | int should_free_val; | 195 | int should_free_val; |
276 | }; | 196 | }; |
277 | 197 | ||
198 | /* | ||
199 | * Ceph dentry state | ||
200 | */ | ||
201 | struct ceph_dentry_info { | ||
202 | struct ceph_mds_session *lease_session; | ||
203 | u32 lease_gen, lease_shared_gen; | ||
204 | u32 lease_seq; | ||
205 | unsigned long lease_renew_after, lease_renew_from; | ||
206 | struct list_head lru; | ||
207 | struct dentry *dentry; | ||
208 | u64 time; | ||
209 | u64 offset; | ||
210 | }; | ||
211 | |||
278 | struct ceph_inode_xattrs_info { | 212 | struct ceph_inode_xattrs_info { |
279 | /* | 213 | /* |
280 | * (still encoded) xattr blob. we avoid the overhead of parsing | 214 | * (still encoded) xattr blob. we avoid the overhead of parsing |
@@ -296,11 +230,6 @@ struct ceph_inode_xattrs_info { | |||
296 | /* | 230 | /* |
297 | * Ceph inode. | 231 | * Ceph inode. |
298 | */ | 232 | */ |
299 | #define CEPH_I_COMPLETE 1 /* we have complete directory cached */ | ||
300 | #define CEPH_I_NODELAY 4 /* do not delay cap release */ | ||
301 | #define CEPH_I_FLUSH 8 /* do not delay flush of dirty metadata */ | ||
302 | #define CEPH_I_NOFLUSH 16 /* do not flush dirty caps */ | ||
303 | |||
304 | struct ceph_inode_info { | 233 | struct ceph_inode_info { |
305 | struct ceph_vino i_vino; /* ceph ino + snap */ | 234 | struct ceph_vino i_vino; /* ceph ino + snap */ |
306 | 235 | ||
@@ -391,6 +320,63 @@ static inline struct ceph_inode_info *ceph_inode(struct inode *inode) | |||
391 | return container_of(inode, struct ceph_inode_info, vfs_inode); | 320 | return container_of(inode, struct ceph_inode_info, vfs_inode); |
392 | } | 321 | } |
393 | 322 | ||
323 | static inline struct ceph_vino ceph_vino(struct inode *inode) | ||
324 | { | ||
325 | return ceph_inode(inode)->i_vino; | ||
326 | } | ||
327 | |||
328 | /* | ||
329 | * ino_t is <64 bits on many architectures, blech. | ||
330 | * | ||
331 | * don't include snap in ino hash, at least for now. | ||
332 | */ | ||
333 | static inline ino_t ceph_vino_to_ino(struct ceph_vino vino) | ||
334 | { | ||
335 | ino_t ino = (ino_t)vino.ino; /* ^ (vino.snap << 20); */ | ||
336 | #if BITS_PER_LONG == 32 | ||
337 | ino ^= vino.ino >> (sizeof(u64)-sizeof(ino_t)) * 8; | ||
338 | if (!ino) | ||
339 | ino = 1; | ||
340 | #endif | ||
341 | return ino; | ||
342 | } | ||
343 | |||
344 | /* for printf-style formatting */ | ||
345 | #define ceph_vinop(i) ceph_inode(i)->i_vino.ino, ceph_inode(i)->i_vino.snap | ||
346 | |||
347 | static inline u64 ceph_ino(struct inode *inode) | ||
348 | { | ||
349 | return ceph_inode(inode)->i_vino.ino; | ||
350 | } | ||
351 | static inline u64 ceph_snap(struct inode *inode) | ||
352 | { | ||
353 | return ceph_inode(inode)->i_vino.snap; | ||
354 | } | ||
355 | |||
356 | static inline int ceph_ino_compare(struct inode *inode, void *data) | ||
357 | { | ||
358 | struct ceph_vino *pvino = (struct ceph_vino *)data; | ||
359 | struct ceph_inode_info *ci = ceph_inode(inode); | ||
360 | return ci->i_vino.ino == pvino->ino && | ||
361 | ci->i_vino.snap == pvino->snap; | ||
362 | } | ||
363 | |||
364 | static inline struct inode *ceph_find_inode(struct super_block *sb, | ||
365 | struct ceph_vino vino) | ||
366 | { | ||
367 | ino_t t = ceph_vino_to_ino(vino); | ||
368 | return ilookup5(sb, t, ceph_ino_compare, &vino); | ||
369 | } | ||
370 | |||
371 | |||
372 | /* | ||
373 | * Ceph inode. | ||
374 | */ | ||
375 | #define CEPH_I_COMPLETE 1 /* we have complete directory cached */ | ||
376 | #define CEPH_I_NODELAY 4 /* do not delay cap release */ | ||
377 | #define CEPH_I_FLUSH 8 /* do not delay flush of dirty metadata */ | ||
378 | #define CEPH_I_NOFLUSH 16 /* do not flush dirty caps */ | ||
379 | |||
394 | static inline void ceph_i_clear(struct inode *inode, unsigned mask) | 380 | static inline void ceph_i_clear(struct inode *inode, unsigned mask) |
395 | { | 381 | { |
396 | struct ceph_inode_info *ci = ceph_inode(inode); | 382 | struct ceph_inode_info *ci = ceph_inode(inode); |
@@ -432,20 +418,6 @@ extern u32 ceph_choose_frag(struct ceph_inode_info *ci, u32 v, | |||
432 | struct ceph_inode_frag *pfrag, | 418 | struct ceph_inode_frag *pfrag, |
433 | int *found); | 419 | int *found); |
434 | 420 | ||
435 | /* | ||
436 | * Ceph dentry state | ||
437 | */ | ||
438 | struct ceph_dentry_info { | ||
439 | struct ceph_mds_session *lease_session; | ||
440 | u32 lease_gen, lease_shared_gen; | ||
441 | u32 lease_seq; | ||
442 | unsigned long lease_renew_after, lease_renew_from; | ||
443 | struct list_head lru; | ||
444 | struct dentry *dentry; | ||
445 | u64 time; | ||
446 | u64 offset; | ||
447 | }; | ||
448 | |||
449 | static inline struct ceph_dentry_info *ceph_dentry(struct dentry *dentry) | 421 | static inline struct ceph_dentry_info *ceph_dentry(struct dentry *dentry) |
450 | { | 422 | { |
451 | return (struct ceph_dentry_info *)dentry->d_fsdata; | 423 | return (struct ceph_dentry_info *)dentry->d_fsdata; |
@@ -456,22 +428,6 @@ static inline loff_t ceph_make_fpos(unsigned frag, unsigned off) | |||
456 | return ((loff_t)frag << 32) | (loff_t)off; | 428 | return ((loff_t)frag << 32) | (loff_t)off; |
457 | } | 429 | } |
458 | 430 | ||
459 | /* | ||
460 | * ino_t is <64 bits on many architectures, blech. | ||
461 | * | ||
462 | * don't include snap in ino hash, at least for now. | ||
463 | */ | ||
464 | static inline ino_t ceph_vino_to_ino(struct ceph_vino vino) | ||
465 | { | ||
466 | ino_t ino = (ino_t)vino.ino; /* ^ (vino.snap << 20); */ | ||
467 | #if BITS_PER_LONG == 32 | ||
468 | ino ^= vino.ino >> (sizeof(u64)-sizeof(ino_t)) * 8; | ||
469 | if (!ino) | ||
470 | ino = 1; | ||
471 | #endif | ||
472 | return ino; | ||
473 | } | ||
474 | |||
475 | static inline int ceph_set_ino_cb(struct inode *inode, void *data) | 431 | static inline int ceph_set_ino_cb(struct inode *inode, void *data) |
476 | { | 432 | { |
477 | ceph_inode(inode)->i_vino = *(struct ceph_vino *)data; | 433 | ceph_inode(inode)->i_vino = *(struct ceph_vino *)data; |
@@ -479,39 +435,6 @@ static inline int ceph_set_ino_cb(struct inode *inode, void *data) | |||
479 | return 0; | 435 | return 0; |
480 | } | 436 | } |
481 | 437 | ||
482 | static inline struct ceph_vino ceph_vino(struct inode *inode) | ||
483 | { | ||
484 | return ceph_inode(inode)->i_vino; | ||
485 | } | ||
486 | |||
487 | /* for printf-style formatting */ | ||
488 | #define ceph_vinop(i) ceph_inode(i)->i_vino.ino, ceph_inode(i)->i_vino.snap | ||
489 | |||
490 | static inline u64 ceph_ino(struct inode *inode) | ||
491 | { | ||
492 | return ceph_inode(inode)->i_vino.ino; | ||
493 | } | ||
494 | static inline u64 ceph_snap(struct inode *inode) | ||
495 | { | ||
496 | return ceph_inode(inode)->i_vino.snap; | ||
497 | } | ||
498 | |||
499 | static inline int ceph_ino_compare(struct inode *inode, void *data) | ||
500 | { | ||
501 | struct ceph_vino *pvino = (struct ceph_vino *)data; | ||
502 | struct ceph_inode_info *ci = ceph_inode(inode); | ||
503 | return ci->i_vino.ino == pvino->ino && | ||
504 | ci->i_vino.snap == pvino->snap; | ||
505 | } | ||
506 | |||
507 | static inline struct inode *ceph_find_inode(struct super_block *sb, | ||
508 | struct ceph_vino vino) | ||
509 | { | ||
510 | ino_t t = ceph_vino_to_ino(vino); | ||
511 | return ilookup5(sb, t, ceph_ino_compare, &vino); | ||
512 | } | ||
513 | |||
514 | |||
515 | /* | 438 | /* |
516 | * caps helpers | 439 | * caps helpers |
517 | */ | 440 | */ |
@@ -576,18 +499,18 @@ extern int ceph_reserve_caps(struct ceph_mds_client *mdsc, | |||
576 | struct ceph_cap_reservation *ctx, int need); | 499 | struct ceph_cap_reservation *ctx, int need); |
577 | extern int ceph_unreserve_caps(struct ceph_mds_client *mdsc, | 500 | extern int ceph_unreserve_caps(struct ceph_mds_client *mdsc, |
578 | struct ceph_cap_reservation *ctx); | 501 | struct ceph_cap_reservation *ctx); |
579 | extern void ceph_reservation_status(struct ceph_client *client, | 502 | extern void ceph_reservation_status(struct ceph_fs_client *client, |
580 | int *total, int *avail, int *used, | 503 | int *total, int *avail, int *used, |
581 | int *reserved, int *min); | 504 | int *reserved, int *min); |
582 | 505 | ||
583 | static inline struct ceph_client *ceph_inode_to_client(struct inode *inode) | 506 | static inline struct ceph_fs_client *ceph_inode_to_client(struct inode *inode) |
584 | { | 507 | { |
585 | return (struct ceph_client *)inode->i_sb->s_fs_info; | 508 | return (struct ceph_fs_client *)inode->i_sb->s_fs_info; |
586 | } | 509 | } |
587 | 510 | ||
588 | static inline struct ceph_client *ceph_sb_to_client(struct super_block *sb) | 511 | static inline struct ceph_fs_client *ceph_sb_to_client(struct super_block *sb) |
589 | { | 512 | { |
590 | return (struct ceph_client *)sb->s_fs_info; | 513 | return (struct ceph_fs_client *)sb->s_fs_info; |
591 | } | 514 | } |
592 | 515 | ||
593 | 516 | ||
@@ -617,51 +540,6 @@ struct ceph_file_info { | |||
617 | 540 | ||
618 | 541 | ||
619 | /* | 542 | /* |
620 | * snapshots | ||
621 | */ | ||
622 | |||
623 | /* | ||
624 | * A "snap context" is the set of existing snapshots when we | ||
625 | * write data. It is used by the OSD to guide its COW behavior. | ||
626 | * | ||
627 | * The ceph_snap_context is refcounted, and attached to each dirty | ||
628 | * page, indicating which context the dirty data belonged when it was | ||
629 | * dirtied. | ||
630 | */ | ||
631 | struct ceph_snap_context { | ||
632 | atomic_t nref; | ||
633 | u64 seq; | ||
634 | int num_snaps; | ||
635 | u64 snaps[]; | ||
636 | }; | ||
637 | |||
638 | static inline struct ceph_snap_context * | ||
639 | ceph_get_snap_context(struct ceph_snap_context *sc) | ||
640 | { | ||
641 | /* | ||
642 | printk("get_snap_context %p %d -> %d\n", sc, atomic_read(&sc->nref), | ||
643 | atomic_read(&sc->nref)+1); | ||
644 | */ | ||
645 | if (sc) | ||
646 | atomic_inc(&sc->nref); | ||
647 | return sc; | ||
648 | } | ||
649 | |||
650 | static inline void ceph_put_snap_context(struct ceph_snap_context *sc) | ||
651 | { | ||
652 | if (!sc) | ||
653 | return; | ||
654 | /* | ||
655 | printk("put_snap_context %p %d -> %d\n", sc, atomic_read(&sc->nref), | ||
656 | atomic_read(&sc->nref)-1); | ||
657 | */ | ||
658 | if (atomic_dec_and_test(&sc->nref)) { | ||
659 | /*printk(" deleting snap_context %p\n", sc);*/ | ||
660 | kfree(sc); | ||
661 | } | ||
662 | } | ||
663 | |||
664 | /* | ||
665 | * A "snap realm" describes a subset of the file hierarchy sharing | 543 | * A "snap realm" describes a subset of the file hierarchy sharing |
666 | * the same set of snapshots that apply to it. The realms themselves | 544 | * the same set of snapshots that apply to it. The realms themselves |
667 | * are organized into a hierarchy, such that children inherit (some of) | 545 | * are organized into a hierarchy, such that children inherit (some of) |
@@ -699,16 +577,33 @@ struct ceph_snap_realm { | |||
699 | spinlock_t inodes_with_caps_lock; | 577 | spinlock_t inodes_with_caps_lock; |
700 | }; | 578 | }; |
701 | 579 | ||
702 | 580 | static inline int default_congestion_kb(void) | |
703 | |||
704 | /* | ||
705 | * calculate the number of pages a given length and offset map onto, | ||
706 | * if we align the data. | ||
707 | */ | ||
708 | static inline int calc_pages_for(u64 off, u64 len) | ||
709 | { | 581 | { |
710 | return ((off+len+PAGE_CACHE_SIZE-1) >> PAGE_CACHE_SHIFT) - | 582 | int congestion_kb; |
711 | (off >> PAGE_CACHE_SHIFT); | 583 | |
584 | /* | ||
585 | * Copied from NFS | ||
586 | * | ||
587 | * congestion size, scale with available memory. | ||
588 | * | ||
589 | * 64MB: 8192k | ||
590 | * 128MB: 11585k | ||
591 | * 256MB: 16384k | ||
592 | * 512MB: 23170k | ||
593 | * 1GB: 32768k | ||
594 | * 2GB: 46340k | ||
595 | * 4GB: 65536k | ||
596 | * 8GB: 92681k | ||
597 | * 16GB: 131072k | ||
598 | * | ||
599 | * This allows larger machines to have larger/more transfers. | ||
600 | * Limit the default to 256M | ||
601 | */ | ||
602 | congestion_kb = (16*int_sqrt(totalram_pages)) << (PAGE_SHIFT-10); | ||
603 | if (congestion_kb > 256*1024) | ||
604 | congestion_kb = 256*1024; | ||
605 | |||
606 | return congestion_kb; | ||
712 | } | 607 | } |
713 | 608 | ||
714 | 609 | ||
@@ -741,16 +636,6 @@ static inline bool __ceph_have_pending_cap_snap(struct ceph_inode_info *ci) | |||
741 | ci_item)->writing; | 636 | ci_item)->writing; |
742 | } | 637 | } |
743 | 638 | ||
744 | |||
745 | /* super.c */ | ||
746 | extern struct kmem_cache *ceph_inode_cachep; | ||
747 | extern struct kmem_cache *ceph_cap_cachep; | ||
748 | extern struct kmem_cache *ceph_dentry_cachep; | ||
749 | extern struct kmem_cache *ceph_file_cachep; | ||
750 | |||
751 | extern const char *ceph_msg_type_name(int type); | ||
752 | extern int ceph_check_fsid(struct ceph_client *client, struct ceph_fsid *fsid); | ||
753 | |||
754 | /* inode.c */ | 639 | /* inode.c */ |
755 | extern const struct inode_operations ceph_file_iops; | 640 | extern const struct inode_operations ceph_file_iops; |
756 | 641 | ||
@@ -857,12 +742,18 @@ extern int ceph_mmap(struct file *file, struct vm_area_struct *vma); | |||
857 | /* file.c */ | 742 | /* file.c */ |
858 | extern const struct file_operations ceph_file_fops; | 743 | extern const struct file_operations ceph_file_fops; |
859 | extern const struct address_space_operations ceph_aops; | 744 | extern const struct address_space_operations ceph_aops; |
745 | extern int ceph_copy_to_page_vector(struct page **pages, | ||
746 | const char *data, | ||
747 | loff_t off, size_t len); | ||
748 | extern int ceph_copy_from_page_vector(struct page **pages, | ||
749 | char *data, | ||
750 | loff_t off, size_t len); | ||
751 | extern struct page **ceph_alloc_page_vector(int num_pages, gfp_t flags); | ||
860 | extern int ceph_open(struct inode *inode, struct file *file); | 752 | extern int ceph_open(struct inode *inode, struct file *file); |
861 | extern struct dentry *ceph_lookup_open(struct inode *dir, struct dentry *dentry, | 753 | extern struct dentry *ceph_lookup_open(struct inode *dir, struct dentry *dentry, |
862 | struct nameidata *nd, int mode, | 754 | struct nameidata *nd, int mode, |
863 | int locked_dir); | 755 | int locked_dir); |
864 | extern int ceph_release(struct inode *inode, struct file *filp); | 756 | extern int ceph_release(struct inode *inode, struct file *filp); |
865 | extern void ceph_release_page_vector(struct page **pages, int num_pages); | ||
866 | 757 | ||
867 | /* dir.c */ | 758 | /* dir.c */ |
868 | extern const struct file_operations ceph_dir_fops; | 759 | extern const struct file_operations ceph_dir_fops; |
@@ -892,12 +783,6 @@ extern long ceph_ioctl(struct file *file, unsigned int cmd, unsigned long arg); | |||
892 | /* export.c */ | 783 | /* export.c */ |
893 | extern const struct export_operations ceph_export_ops; | 784 | extern const struct export_operations ceph_export_ops; |
894 | 785 | ||
895 | /* debugfs.c */ | ||
896 | extern int ceph_debugfs_init(void); | ||
897 | extern void ceph_debugfs_cleanup(void); | ||
898 | extern int ceph_debugfs_client_init(struct ceph_client *client); | ||
899 | extern void ceph_debugfs_client_cleanup(struct ceph_client *client); | ||
900 | |||
901 | /* locks.c */ | 786 | /* locks.c */ |
902 | extern int ceph_lock(struct file *file, int cmd, struct file_lock *fl); | 787 | extern int ceph_lock(struct file *file, int cmd, struct file_lock *fl); |
903 | extern int ceph_flock(struct file *file, int cmd, struct file_lock *fl); | 788 | extern int ceph_flock(struct file *file, int cmd, struct file_lock *fl); |
@@ -914,4 +799,8 @@ static inline struct inode *get_dentry_parent_inode(struct dentry *dentry) | |||
914 | return NULL; | 799 | return NULL; |
915 | } | 800 | } |
916 | 801 | ||
802 | /* debugfs.c */ | ||
803 | extern int ceph_fs_debugfs_init(struct ceph_fs_client *client); | ||
804 | extern void ceph_fs_debugfs_cleanup(struct ceph_fs_client *client); | ||
805 | |||
917 | #endif /* _FS_CEPH_SUPER_H */ | 806 | #endif /* _FS_CEPH_SUPER_H */ |