| .. | .. |
|---|
| 16 | 16 | #include <linux/slab.h> |
|---|
| 17 | 17 | #include <linux/posix_acl.h> |
|---|
| 18 | 18 | #include <linux/refcount.h> |
|---|
| 19 | +#include <linux/security.h> |
|---|
| 19 | 20 | |
|---|
| 20 | 21 | #include <linux/ceph/libceph.h> |
|---|
| 21 | 22 | |
|---|
| .. | .. |
|---|
| 31 | 32 | #define CEPH_BLOCK_SHIFT 22 /* 4 MB */ |
|---|
| 32 | 33 | #define CEPH_BLOCK (1 << CEPH_BLOCK_SHIFT) |
|---|
| 33 | 34 | |
|---|
| 35 | +#define CEPH_MOUNT_OPT_CLEANRECOVER (1<<1) /* auto reonnect (clean mode) after blocklisted */ |
|---|
| 34 | 36 | #define CEPH_MOUNT_OPT_DIRSTAT (1<<4) /* `cat dirname` for stats */ |
|---|
| 35 | 37 | #define CEPH_MOUNT_OPT_RBYTES (1<<5) /* dir st_bytes = rbytes */ |
|---|
| 36 | 38 | #define CEPH_MOUNT_OPT_NOASYNCREADDIR (1<<7) /* no dcache readdir */ |
|---|
| .. | .. |
|---|
| 40 | 42 | #define CEPH_MOUNT_OPT_NOPOOLPERM (1<<11) /* no pool permission check */ |
|---|
| 41 | 43 | #define CEPH_MOUNT_OPT_MOUNTWAIT (1<<12) /* mount waits if no mds is up */ |
|---|
| 42 | 44 | #define CEPH_MOUNT_OPT_NOQUOTADF (1<<13) /* no root dir quota in statfs */ |
|---|
| 45 | +#define CEPH_MOUNT_OPT_NOCOPYFROM (1<<14) /* don't use RADOS 'copy-from' op */ |
|---|
| 46 | +#define CEPH_MOUNT_OPT_ASYNC_DIROPS (1<<15) /* allow async directory ops */ |
|---|
| 43 | 47 | |
|---|
| 44 | | -#define CEPH_MOUNT_OPT_DEFAULT CEPH_MOUNT_OPT_DCACHE |
|---|
| 48 | +#define CEPH_MOUNT_OPT_DEFAULT \ |
|---|
| 49 | + (CEPH_MOUNT_OPT_DCACHE | \ |
|---|
| 50 | + CEPH_MOUNT_OPT_NOCOPYFROM) |
|---|
| 45 | 51 | |
|---|
| 46 | 52 | #define ceph_set_mount_opt(fsc, opt) \ |
|---|
| 47 | | - (fsc)->mount_options->flags |= CEPH_MOUNT_OPT_##opt; |
|---|
| 53 | + (fsc)->mount_options->flags |= CEPH_MOUNT_OPT_##opt |
|---|
| 54 | +#define ceph_clear_mount_opt(fsc, opt) \ |
|---|
| 55 | + (fsc)->mount_options->flags &= ~CEPH_MOUNT_OPT_##opt |
|---|
| 48 | 56 | #define ceph_test_mount_opt(fsc, opt) \ |
|---|
| 49 | 57 | (!!((fsc)->mount_options->flags & CEPH_MOUNT_OPT_##opt)) |
|---|
| 50 | 58 | |
|---|
| .. | .. |
|---|
| 68 | 76 | #define CEPH_CAPS_WANTED_DELAY_MAX_DEFAULT 60 /* cap release delay */ |
|---|
| 69 | 77 | |
|---|
| 70 | 78 | struct ceph_mount_options { |
|---|
| 71 | | - int flags; |
|---|
| 72 | | - int sb_flags; |
|---|
| 79 | + unsigned int flags; |
|---|
| 73 | 80 | |
|---|
| 74 | | - int wsize; /* max write size */ |
|---|
| 75 | | - int rsize; /* max read size */ |
|---|
| 76 | | - int rasize; /* max readahead */ |
|---|
| 77 | | - int congestion_kb; /* max writeback in flight */ |
|---|
| 78 | | - int caps_wanted_delay_min, caps_wanted_delay_max; |
|---|
| 79 | | - int max_readdir; /* max readdir result (entires) */ |
|---|
| 80 | | - int max_readdir_bytes; /* max readdir result (bytes) */ |
|---|
| 81 | + unsigned int wsize; /* max write size */ |
|---|
| 82 | + unsigned int rsize; /* max read size */ |
|---|
| 83 | + unsigned int rasize; /* max readahead */ |
|---|
| 84 | + unsigned int congestion_kb; /* max writeback in flight */ |
|---|
| 85 | + unsigned int caps_wanted_delay_min, caps_wanted_delay_max; |
|---|
| 86 | + int caps_max; |
|---|
| 87 | + unsigned int max_readdir; /* max readdir result (entries) */ |
|---|
| 88 | + unsigned int max_readdir_bytes; /* max readdir result (bytes) */ |
|---|
| 81 | 89 | |
|---|
| 82 | 90 | /* |
|---|
| 83 | 91 | * everything above this point can be memcmp'd; everything below |
|---|
| .. | .. |
|---|
| 93 | 101 | struct ceph_fs_client { |
|---|
| 94 | 102 | struct super_block *sb; |
|---|
| 95 | 103 | |
|---|
| 104 | + struct list_head metric_wakeup; |
|---|
| 105 | + |
|---|
| 96 | 106 | struct ceph_mount_options *mount_options; |
|---|
| 97 | 107 | struct ceph_client *client; |
|---|
| 98 | 108 | |
|---|
| 99 | 109 | unsigned long mount_state; |
|---|
| 100 | | - int min_caps; /* min caps i added */ |
|---|
| 110 | + |
|---|
| 111 | + unsigned long last_auto_reconnect; |
|---|
| 112 | + bool blocklisted; |
|---|
| 113 | + |
|---|
| 114 | + bool have_copy_from2; |
|---|
| 115 | + |
|---|
| 116 | + u32 filp_gen; |
|---|
| 101 | 117 | loff_t max_file_size; |
|---|
| 102 | 118 | |
|---|
| 103 | 119 | struct ceph_mds_client *mdsc; |
|---|
| 104 | 120 | |
|---|
| 105 | | - /* writeback */ |
|---|
| 106 | | - mempool_t *wb_pagevec_pool; |
|---|
| 107 | | - struct workqueue_struct *wb_wq; |
|---|
| 108 | | - struct workqueue_struct *pg_inv_wq; |
|---|
| 109 | | - struct workqueue_struct *trunc_wq; |
|---|
| 110 | 121 | atomic_long_t writeback_count; |
|---|
| 122 | + |
|---|
| 123 | + struct workqueue_struct *inode_wq; |
|---|
| 124 | + struct workqueue_struct *cap_wq; |
|---|
| 111 | 125 | |
|---|
| 112 | 126 | #ifdef CONFIG_DEBUG_FS |
|---|
| 113 | 127 | struct dentry *debugfs_dentry_lru, *debugfs_caps; |
|---|
| 114 | 128 | struct dentry *debugfs_congestion_kb; |
|---|
| 115 | 129 | struct dentry *debugfs_bdi; |
|---|
| 116 | 130 | struct dentry *debugfs_mdsc, *debugfs_mdsmap; |
|---|
| 131 | + struct dentry *debugfs_metric; |
|---|
| 117 | 132 | struct dentry *debugfs_mds_sessions; |
|---|
| 118 | 133 | #endif |
|---|
| 119 | 134 | |
|---|
| .. | .. |
|---|
| 145 | 160 | int issued; /* latest, from the mds */ |
|---|
| 146 | 161 | int implemented; /* implemented superset of |
|---|
| 147 | 162 | issued (for revocation) */ |
|---|
| 148 | | - int mds, mds_wanted; |
|---|
| 163 | + int mds; /* mds index for this cap */ |
|---|
| 164 | + int mds_wanted; /* caps wanted from this mds */ |
|---|
| 149 | 165 | }; |
|---|
| 150 | 166 | /* caps to release */ |
|---|
| 151 | 167 | struct { |
|---|
| .. | .. |
|---|
| 159 | 175 | struct list_head caps_item; |
|---|
| 160 | 176 | }; |
|---|
| 161 | 177 | |
|---|
| 162 | | -#define CHECK_CAPS_NODELAY 1 /* do not delay any further */ |
|---|
| 163 | | -#define CHECK_CAPS_AUTHONLY 2 /* only check auth cap */ |
|---|
| 164 | | -#define CHECK_CAPS_FLUSH 4 /* flush any dirty caps */ |
|---|
| 178 | +#define CHECK_CAPS_AUTHONLY 1 /* only check auth cap */ |
|---|
| 179 | +#define CHECK_CAPS_FLUSH 2 /* flush any dirty caps */ |
|---|
| 180 | +#define CHECK_CAPS_NOINVAL 4 /* don't invalidate pagecache */ |
|---|
| 165 | 181 | |
|---|
| 166 | 182 | struct ceph_cap_flush { |
|---|
| 167 | 183 | u64 tid; |
|---|
| 168 | | - int caps; /* 0 means capsnap */ |
|---|
| 184 | + int caps; |
|---|
| 169 | 185 | bool wake; /* wake up flush waiters when finish ? */ |
|---|
| 186 | + bool is_capsnap; /* true means capsnap */ |
|---|
| 170 | 187 | struct list_head g_list; // global |
|---|
| 171 | 188 | struct list_head i_list; // per inode |
|---|
| 172 | 189 | }; |
|---|
| .. | .. |
|---|
| 194 | 211 | u64 xattr_version; |
|---|
| 195 | 212 | |
|---|
| 196 | 213 | u64 size; |
|---|
| 197 | | - struct timespec64 mtime, atime, ctime; |
|---|
| 214 | + u64 change_attr; |
|---|
| 215 | + struct timespec64 mtime, atime, ctime, btime; |
|---|
| 198 | 216 | u64 time_warp_seq; |
|---|
| 199 | 217 | u64 truncate_size; |
|---|
| 200 | 218 | u32 truncate_seq; |
|---|
| .. | .. |
|---|
| 257 | 275 | * Ceph dentry state |
|---|
| 258 | 276 | */ |
|---|
| 259 | 277 | struct ceph_dentry_info { |
|---|
| 278 | + struct dentry *dentry; |
|---|
| 260 | 279 | struct ceph_mds_session *lease_session; |
|---|
| 280 | + struct list_head lease_list; |
|---|
| 281 | + unsigned flags; |
|---|
| 261 | 282 | int lease_shared_gen; |
|---|
| 262 | 283 | u32 lease_gen; |
|---|
| 263 | 284 | u32 lease_seq; |
|---|
| 264 | 285 | unsigned long lease_renew_after, lease_renew_from; |
|---|
| 265 | | - struct list_head lru; |
|---|
| 266 | | - struct dentry *dentry; |
|---|
| 267 | 286 | unsigned long time; |
|---|
| 268 | 287 | u64 offset; |
|---|
| 269 | 288 | }; |
|---|
| 289 | + |
|---|
| 290 | +#define CEPH_DENTRY_REFERENCED 1 |
|---|
| 291 | +#define CEPH_DENTRY_LEASE_LIST 2 |
|---|
| 292 | +#define CEPH_DENTRY_SHRINK_LIST 4 |
|---|
| 293 | +#define CEPH_DENTRY_PRIMARY_LINK 8 |
|---|
| 270 | 294 | |
|---|
| 271 | 295 | struct ceph_inode_xattrs_info { |
|---|
| 272 | 296 | /* |
|---|
| .. | .. |
|---|
| 298 | 322 | u64 i_inline_version; |
|---|
| 299 | 323 | u32 i_time_warp_seq; |
|---|
| 300 | 324 | |
|---|
| 301 | | - unsigned i_ceph_flags; |
|---|
| 325 | + unsigned long i_ceph_flags; |
|---|
| 302 | 326 | atomic64_t i_release_count; |
|---|
| 303 | 327 | atomic64_t i_ordered_count; |
|---|
| 304 | 328 | atomic64_t i_complete_seq[2]; |
|---|
| 305 | 329 | |
|---|
| 306 | 330 | struct ceph_dir_layout i_dir_layout; |
|---|
| 307 | 331 | struct ceph_file_layout i_layout; |
|---|
| 332 | + struct ceph_file_layout i_cached_layout; // for async creates |
|---|
| 308 | 333 | char *i_symlink; |
|---|
| 309 | 334 | |
|---|
| 310 | 335 | /* for dirs */ |
|---|
| .. | .. |
|---|
| 314 | 339 | |
|---|
| 315 | 340 | /* quotas */ |
|---|
| 316 | 341 | u64 i_max_bytes, i_max_files; |
|---|
| 342 | + |
|---|
| 343 | + s32 i_dir_pin; |
|---|
| 317 | 344 | |
|---|
| 318 | 345 | struct rb_root i_fragtree; |
|---|
| 319 | 346 | int i_fragtree_nsplits; |
|---|
| .. | .. |
|---|
| 326 | 353 | struct rb_root i_caps; /* cap list */ |
|---|
| 327 | 354 | struct ceph_cap *i_auth_cap; /* authoritative cap, if any */ |
|---|
| 328 | 355 | unsigned i_dirty_caps, i_flushing_caps; /* mask of dirtied fields */ |
|---|
| 329 | | - struct list_head i_dirty_item, i_flushing_item; |
|---|
| 356 | + |
|---|
| 357 | + /* |
|---|
| 358 | + * Link to the auth cap's session's s_cap_dirty list. s_cap_dirty |
|---|
| 359 | + * is protected by the mdsc->cap_dirty_lock, but each individual item |
|---|
| 360 | + * is also protected by the inode's i_ceph_lock. Walking s_cap_dirty |
|---|
| 361 | + * requires the mdsc->cap_dirty_lock. List presence for an item can |
|---|
| 362 | + * be tested under the i_ceph_lock. Changing anything requires both. |
|---|
| 363 | + */ |
|---|
| 364 | + struct list_head i_dirty_item; |
|---|
| 365 | + |
|---|
| 366 | + /* |
|---|
| 367 | + * Link to session's s_cap_flushing list. Protected in a similar |
|---|
| 368 | + * fashion to i_dirty_item, but also by the s_mutex for changes. The |
|---|
| 369 | + * s_cap_flushing list can be walked while holding either the s_mutex |
|---|
| 370 | + * or msdc->cap_dirty_lock. List presence can also be checked while |
|---|
| 371 | + * holding the i_ceph_lock for this inode. |
|---|
| 372 | + */ |
|---|
| 373 | + struct list_head i_flushing_item; |
|---|
| 374 | + |
|---|
| 330 | 375 | /* we need to track cap writeback on a per-cap-bit basis, to allow |
|---|
| 331 | 376 | * overlapping, pipelined cap flushes to the mds. we can probably |
|---|
| 332 | 377 | * reduce the tid to 8 bits if we're concerned about inode size. */ |
|---|
| 333 | 378 | struct ceph_cap_flush *i_prealloc_cap_flush; |
|---|
| 334 | 379 | struct list_head i_cap_flush_list; |
|---|
| 335 | 380 | wait_queue_head_t i_cap_wq; /* threads waiting on a capability */ |
|---|
| 336 | | - unsigned long i_hold_caps_min; /* jiffies */ |
|---|
| 337 | 381 | unsigned long i_hold_caps_max; /* jiffies */ |
|---|
| 338 | 382 | struct list_head i_cap_delay_list; /* for delayed cap release to mds */ |
|---|
| 339 | 383 | struct ceph_cap_reservation i_cap_migration_resv; |
|---|
| .. | .. |
|---|
| 342 | 386 | dirty|flushing caps */ |
|---|
| 343 | 387 | unsigned i_snap_caps; /* cap bits for snapped files */ |
|---|
| 344 | 388 | |
|---|
| 389 | + unsigned long i_last_rd; |
|---|
| 390 | + unsigned long i_last_wr; |
|---|
| 345 | 391 | int i_nr_by_mode[CEPH_FILE_MODE_BITS]; /* open file counts */ |
|---|
| 346 | 392 | |
|---|
| 347 | 393 | struct mutex i_truncate_mutex; |
|---|
| .. | .. |
|---|
| 356 | 402 | |
|---|
| 357 | 403 | /* held references to caps */ |
|---|
| 358 | 404 | int i_pin_ref; |
|---|
| 359 | | - int i_rd_ref, i_rdcache_ref, i_wr_ref, i_wb_ref; |
|---|
| 405 | + int i_rd_ref, i_rdcache_ref, i_wr_ref, i_wb_ref, i_fx_ref; |
|---|
| 360 | 406 | int i_wrbuffer_ref, i_wrbuffer_ref_head; |
|---|
| 361 | 407 | atomic_t i_filelock_ref; |
|---|
| 362 | 408 | atomic_t i_shared_gen; /* increment each time we get FILE_SHARED */ |
|---|
| .. | .. |
|---|
| 367 | 413 | struct list_head i_unsafe_iops; /* uncommitted mds inode ops */ |
|---|
| 368 | 414 | spinlock_t i_unsafe_lock; |
|---|
| 369 | 415 | |
|---|
| 370 | | - struct ceph_snap_realm *i_snap_realm; /* snap realm (if caps) */ |
|---|
| 416 | + union { |
|---|
| 417 | + struct ceph_snap_realm *i_snap_realm; /* snap realm (if caps) */ |
|---|
| 418 | + struct ceph_snapid_map *i_snapid_map; /* snapid -> dev_t */ |
|---|
| 419 | + }; |
|---|
| 371 | 420 | int i_snap_realm_counter; /* snap realm (if caps) */ |
|---|
| 372 | 421 | struct list_head i_snap_realm_item; |
|---|
| 373 | 422 | struct list_head i_snap_flush_item; |
|---|
| 423 | + struct timespec64 i_btime; |
|---|
| 424 | + struct timespec64 i_snap_btime; |
|---|
| 374 | 425 | |
|---|
| 375 | | - struct work_struct i_wb_work; /* writeback work */ |
|---|
| 376 | | - struct work_struct i_pg_inv_work; /* page invalidation work */ |
|---|
| 377 | | - |
|---|
| 378 | | - struct work_struct i_vmtruncate_work; |
|---|
| 426 | + struct work_struct i_work; |
|---|
| 427 | + unsigned long i_work_mask; |
|---|
| 379 | 428 | |
|---|
| 380 | 429 | #ifdef CONFIG_CEPH_FSCACHE |
|---|
| 381 | 430 | struct fscache_cookie *fscache; |
|---|
| .. | .. |
|---|
| 384 | 433 | struct inode vfs_inode; /* at end */ |
|---|
| 385 | 434 | }; |
|---|
| 386 | 435 | |
|---|
| 387 | | -static inline struct ceph_inode_info *ceph_inode(struct inode *inode) |
|---|
| 436 | +static inline struct ceph_inode_info * |
|---|
| 437 | +ceph_inode(const struct inode *inode) |
|---|
| 388 | 438 | { |
|---|
| 389 | 439 | return container_of(inode, struct ceph_inode_info, vfs_inode); |
|---|
| 390 | 440 | } |
|---|
| 391 | 441 | |
|---|
| 392 | | -static inline struct ceph_fs_client *ceph_inode_to_client(struct inode *inode) |
|---|
| 442 | +static inline struct ceph_fs_client * |
|---|
| 443 | +ceph_inode_to_client(const struct inode *inode) |
|---|
| 393 | 444 | { |
|---|
| 394 | 445 | return (struct ceph_fs_client *)inode->i_sb->s_fs_info; |
|---|
| 395 | 446 | } |
|---|
| 396 | 447 | |
|---|
| 397 | | -static inline struct ceph_fs_client *ceph_sb_to_client(struct super_block *sb) |
|---|
| 448 | +static inline struct ceph_fs_client * |
|---|
| 449 | +ceph_sb_to_client(const struct super_block *sb) |
|---|
| 398 | 450 | { |
|---|
| 399 | 451 | return (struct ceph_fs_client *)sb->s_fs_info; |
|---|
| 400 | 452 | } |
|---|
| 401 | 453 | |
|---|
| 402 | | -static inline struct ceph_vino ceph_vino(struct inode *inode) |
|---|
| 454 | +static inline struct ceph_mds_client * |
|---|
| 455 | +ceph_sb_to_mdsc(const struct super_block *sb) |
|---|
| 456 | +{ |
|---|
| 457 | + return (struct ceph_mds_client *)ceph_sb_to_client(sb)->mdsc; |
|---|
| 458 | +} |
|---|
| 459 | + |
|---|
| 460 | +static inline struct ceph_vino |
|---|
| 461 | +ceph_vino(const struct inode *inode) |
|---|
| 403 | 462 | { |
|---|
| 404 | 463 | return ceph_inode(inode)->i_vino; |
|---|
| 405 | 464 | } |
|---|
| 406 | 465 | |
|---|
| 407 | | -/* |
|---|
| 408 | | - * ino_t is <64 bits on many architectures, blech. |
|---|
| 409 | | - * |
|---|
| 410 | | - * i_ino (kernel inode) st_ino (userspace) |
|---|
| 411 | | - * i386 32 32 |
|---|
| 412 | | - * x86_64+ino32 64 32 |
|---|
| 413 | | - * x86_64 64 64 |
|---|
| 414 | | - */ |
|---|
| 415 | | -static inline u32 ceph_ino_to_ino32(__u64 vino) |
|---|
| 466 | +static inline u32 ceph_ino_to_ino32(u64 vino) |
|---|
| 416 | 467 | { |
|---|
| 417 | 468 | u32 ino = vino & 0xffffffff; |
|---|
| 418 | 469 | ino ^= vino >> 32; |
|---|
| .. | .. |
|---|
| 422 | 473 | } |
|---|
| 423 | 474 | |
|---|
| 424 | 475 | /* |
|---|
| 425 | | - * kernel i_ino value |
|---|
| 476 | + * Inode numbers in cephfs are 64 bits, but inode->i_ino is 32-bits on |
|---|
| 477 | + * some arches. We generally do not use this value inside the ceph driver, but |
|---|
| 478 | + * we do want to set it to something, so that generic vfs code has an |
|---|
| 479 | + * appropriate value for tracepoints and the like. |
|---|
| 426 | 480 | */ |
|---|
| 427 | | -static inline ino_t ceph_vino_to_ino(struct ceph_vino vino) |
|---|
| 481 | +static inline ino_t ceph_vino_to_ino_t(struct ceph_vino vino) |
|---|
| 428 | 482 | { |
|---|
| 429 | | -#if BITS_PER_LONG == 32 |
|---|
| 430 | | - return ceph_ino_to_ino32(vino.ino); |
|---|
| 431 | | -#else |
|---|
| 483 | + if (sizeof(ino_t) == sizeof(u32)) |
|---|
| 484 | + return ceph_ino_to_ino32(vino.ino); |
|---|
| 432 | 485 | return (ino_t)vino.ino; |
|---|
| 433 | | -#endif |
|---|
| 434 | 486 | } |
|---|
| 435 | | - |
|---|
| 436 | | -/* |
|---|
| 437 | | - * user-visible ino (stat, filldir) |
|---|
| 438 | | - */ |
|---|
| 439 | | -#if BITS_PER_LONG == 32 |
|---|
| 440 | | -static inline ino_t ceph_translate_ino(struct super_block *sb, ino_t ino) |
|---|
| 441 | | -{ |
|---|
| 442 | | - return ino; |
|---|
| 443 | | -} |
|---|
| 444 | | -#else |
|---|
| 445 | | -static inline ino_t ceph_translate_ino(struct super_block *sb, ino_t ino) |
|---|
| 446 | | -{ |
|---|
| 447 | | - if (ceph_test_mount_opt(ceph_sb_to_client(sb), INO32)) |
|---|
| 448 | | - ino = ceph_ino_to_ino32(ino); |
|---|
| 449 | | - return ino; |
|---|
| 450 | | -} |
|---|
| 451 | | -#endif |
|---|
| 452 | | - |
|---|
| 453 | 487 | |
|---|
| 454 | 488 | /* for printf-style formatting */ |
|---|
| 455 | 489 | #define ceph_vinop(i) ceph_inode(i)->i_vino.ino, ceph_inode(i)->i_vino.snap |
|---|
| .. | .. |
|---|
| 458 | 492 | { |
|---|
| 459 | 493 | return ceph_inode(inode)->i_vino.ino; |
|---|
| 460 | 494 | } |
|---|
| 495 | + |
|---|
| 461 | 496 | static inline u64 ceph_snap(struct inode *inode) |
|---|
| 462 | 497 | { |
|---|
| 463 | 498 | return ceph_inode(inode)->i_vino.snap; |
|---|
| 499 | +} |
|---|
| 500 | + |
|---|
| 501 | +/** |
|---|
| 502 | + * ceph_present_ino - format an inode number for presentation to userland |
|---|
| 503 | + * @sb: superblock where the inode lives |
|---|
| 504 | + * @ino: inode number to (possibly) convert |
|---|
| 505 | + * |
|---|
| 506 | + * If the user mounted with the ino32 option, then the 64-bit value needs |
|---|
| 507 | + * to be converted to something that can fit inside 32 bits. Note that |
|---|
| 508 | + * internal kernel code never uses this value, so this is entirely for |
|---|
| 509 | + * userland consumption. |
|---|
| 510 | + */ |
|---|
| 511 | +static inline u64 ceph_present_ino(struct super_block *sb, u64 ino) |
|---|
| 512 | +{ |
|---|
| 513 | + if (unlikely(ceph_test_mount_opt(ceph_sb_to_client(sb), INO32))) |
|---|
| 514 | + return ceph_ino_to_ino32(ino); |
|---|
| 515 | + return ino; |
|---|
| 516 | +} |
|---|
| 517 | + |
|---|
| 518 | +static inline u64 ceph_present_inode(struct inode *inode) |
|---|
| 519 | +{ |
|---|
| 520 | + return ceph_present_ino(inode->i_sb, ceph_ino(inode)); |
|---|
| 464 | 521 | } |
|---|
| 465 | 522 | |
|---|
| 466 | 523 | static inline int ceph_ino_compare(struct inode *inode, void *data) |
|---|
| .. | .. |
|---|
| 471 | 528 | ci->i_vino.snap == pvino->snap; |
|---|
| 472 | 529 | } |
|---|
| 473 | 530 | |
|---|
| 531 | +/* |
|---|
| 532 | + * The MDS reserves a set of inodes for its own usage. These should never |
|---|
| 533 | + * be accessible by clients, and so the MDS has no reason to ever hand these |
|---|
| 534 | + * out. The range is CEPH_MDS_INO_MDSDIR_OFFSET..CEPH_INO_SYSTEM_BASE. |
|---|
| 535 | + * |
|---|
| 536 | + * These come from src/mds/mdstypes.h in the ceph sources. |
|---|
| 537 | + */ |
|---|
| 538 | +#define CEPH_MAX_MDS 0x100 |
|---|
| 539 | +#define CEPH_NUM_STRAY 10 |
|---|
| 540 | +#define CEPH_MDS_INO_MDSDIR_OFFSET (1 * CEPH_MAX_MDS) |
|---|
| 541 | +#define CEPH_INO_SYSTEM_BASE ((6*CEPH_MAX_MDS) + (CEPH_MAX_MDS * CEPH_NUM_STRAY)) |
|---|
| 542 | + |
|---|
| 543 | +static inline bool ceph_vino_is_reserved(const struct ceph_vino vino) |
|---|
| 544 | +{ |
|---|
| 545 | + if (vino.ino < CEPH_INO_SYSTEM_BASE && |
|---|
| 546 | + vino.ino >= CEPH_MDS_INO_MDSDIR_OFFSET) { |
|---|
| 547 | + WARN_RATELIMIT(1, "Attempt to access reserved inode number 0x%llx", vino.ino); |
|---|
| 548 | + return true; |
|---|
| 549 | + } |
|---|
| 550 | + return false; |
|---|
| 551 | +} |
|---|
| 552 | + |
|---|
| 474 | 553 | static inline struct inode *ceph_find_inode(struct super_block *sb, |
|---|
| 475 | 554 | struct ceph_vino vino) |
|---|
| 476 | 555 | { |
|---|
| 477 | | - ino_t t = ceph_vino_to_ino(vino); |
|---|
| 478 | | - return ilookup5(sb, t, ceph_ino_compare, &vino); |
|---|
| 556 | + if (ceph_vino_is_reserved(vino)) |
|---|
| 557 | + return NULL; |
|---|
| 558 | + |
|---|
| 559 | + /* |
|---|
| 560 | + * NB: The hashval will be run through the fs/inode.c hash function |
|---|
| 561 | + * anyway, so there is no need to squash the inode number down to |
|---|
| 562 | + * 32-bits first. Just use low-order bits on arches with 32-bit long. |
|---|
| 563 | + */ |
|---|
| 564 | + return ilookup5(sb, (unsigned long)vino.ino, ceph_ino_compare, &vino); |
|---|
| 479 | 565 | } |
|---|
| 480 | 566 | |
|---|
| 481 | 567 | |
|---|
| .. | .. |
|---|
| 483 | 569 | * Ceph inode. |
|---|
| 484 | 570 | */ |
|---|
| 485 | 571 | #define CEPH_I_DIR_ORDERED (1 << 0) /* dentries in dir are ordered */ |
|---|
| 486 | | -#define CEPH_I_NODELAY (1 << 1) /* do not delay cap release */ |
|---|
| 487 | 572 | #define CEPH_I_FLUSH (1 << 2) /* do not delay flush of dirty metadata */ |
|---|
| 488 | | -#define CEPH_I_NOFLUSH (1 << 3) /* do not flush dirty caps */ |
|---|
| 489 | | -#define CEPH_I_POOL_PERM (1 << 4) /* pool rd/wr bits are valid */ |
|---|
| 490 | | -#define CEPH_I_POOL_RD (1 << 5) /* can read from pool */ |
|---|
| 491 | | -#define CEPH_I_POOL_WR (1 << 6) /* can write to pool */ |
|---|
| 492 | | -#define CEPH_I_SEC_INITED (1 << 7) /* security initialized */ |
|---|
| 493 | | -#define CEPH_I_CAP_DROPPED (1 << 8) /* caps were forcibly dropped */ |
|---|
| 494 | | -#define CEPH_I_KICK_FLUSH (1 << 9) /* kick flushing caps */ |
|---|
| 495 | | -#define CEPH_I_FLUSH_SNAPS (1 << 10) /* need flush snapss */ |
|---|
| 496 | | -#define CEPH_I_ERROR_WRITE (1 << 11) /* have seen write errors */ |
|---|
| 497 | | -#define CEPH_I_ERROR_FILELOCK (1 << 12) /* have seen file lock errors */ |
|---|
| 573 | +#define CEPH_I_POOL_PERM (1 << 3) /* pool rd/wr bits are valid */ |
|---|
| 574 | +#define CEPH_I_POOL_RD (1 << 4) /* can read from pool */ |
|---|
| 575 | +#define CEPH_I_POOL_WR (1 << 5) /* can write to pool */ |
|---|
| 576 | +#define CEPH_I_SEC_INITED (1 << 6) /* security initialized */ |
|---|
| 577 | +#define CEPH_I_KICK_FLUSH (1 << 7) /* kick flushing caps */ |
|---|
| 578 | +#define CEPH_I_FLUSH_SNAPS (1 << 8) /* need flush snapss */ |
|---|
| 579 | +#define CEPH_I_ERROR_WRITE (1 << 9) /* have seen write errors */ |
|---|
| 580 | +#define CEPH_I_ERROR_FILELOCK (1 << 10) /* have seen file lock errors */ |
|---|
| 581 | +#define CEPH_I_ODIRECT (1 << 11) /* inode in direct I/O mode */ |
|---|
| 582 | +#define CEPH_ASYNC_CREATE_BIT (12) /* async create in flight for this */ |
|---|
| 583 | +#define CEPH_I_ASYNC_CREATE (1 << CEPH_ASYNC_CREATE_BIT) |
|---|
| 498 | 584 | |
|---|
| 585 | +/* |
|---|
| 586 | + * Masks of ceph inode work. |
|---|
| 587 | + */ |
|---|
| 588 | +#define CEPH_I_WORK_WRITEBACK 0 /* writeback */ |
|---|
| 589 | +#define CEPH_I_WORK_INVALIDATE_PAGES 1 /* invalidate pages */ |
|---|
| 590 | +#define CEPH_I_WORK_VMTRUNCATE 2 /* vmtruncate */ |
|---|
| 499 | 591 | |
|---|
| 500 | 592 | /* |
|---|
| 501 | 593 | * We set the ERROR_WRITE bit when we start seeing write errors on an inode |
|---|
| .. | .. |
|---|
| 589 | 681 | struct ceph_inode_frag *pfrag, |
|---|
| 590 | 682 | int *found); |
|---|
| 591 | 683 | |
|---|
| 592 | | -static inline struct ceph_dentry_info *ceph_dentry(struct dentry *dentry) |
|---|
| 684 | +static inline struct ceph_dentry_info *ceph_dentry(const struct dentry *dentry) |
|---|
| 593 | 685 | { |
|---|
| 594 | 686 | return (struct ceph_dentry_info *)dentry->d_fsdata; |
|---|
| 595 | 687 | } |
|---|
| .. | .. |
|---|
| 604 | 696 | |
|---|
| 605 | 697 | extern int __ceph_caps_issued(struct ceph_inode_info *ci, int *implemented); |
|---|
| 606 | 698 | extern int __ceph_caps_issued_mask(struct ceph_inode_info *ci, int mask, int t); |
|---|
| 699 | +extern int __ceph_caps_issued_mask_metric(struct ceph_inode_info *ci, int mask, |
|---|
| 700 | + int t); |
|---|
| 607 | 701 | extern int __ceph_caps_issued_other(struct ceph_inode_info *ci, |
|---|
| 608 | 702 | struct ceph_cap *cap); |
|---|
| 609 | 703 | |
|---|
| .. | .. |
|---|
| 616 | 710 | return issued; |
|---|
| 617 | 711 | } |
|---|
| 618 | 712 | |
|---|
| 619 | | -static inline int ceph_caps_issued_mask(struct ceph_inode_info *ci, int mask, |
|---|
| 620 | | - int touch) |
|---|
| 713 | +static inline int ceph_caps_issued_mask_metric(struct ceph_inode_info *ci, |
|---|
| 714 | + int mask, int touch) |
|---|
| 621 | 715 | { |
|---|
| 622 | 716 | int r; |
|---|
| 623 | 717 | spin_lock(&ci->i_ceph_lock); |
|---|
| 624 | | - r = __ceph_caps_issued_mask(ci, mask, touch); |
|---|
| 718 | + r = __ceph_caps_issued_mask_metric(ci, mask, touch); |
|---|
| 625 | 719 | spin_unlock(&ci->i_ceph_lock); |
|---|
| 626 | 720 | return r; |
|---|
| 627 | 721 | } |
|---|
| .. | .. |
|---|
| 640 | 734 | extern int ceph_caps_revoking(struct ceph_inode_info *ci, int mask); |
|---|
| 641 | 735 | extern int __ceph_caps_used(struct ceph_inode_info *ci); |
|---|
| 642 | 736 | |
|---|
| 643 | | -extern int __ceph_caps_file_wanted(struct ceph_inode_info *ci); |
|---|
| 644 | | - |
|---|
| 645 | | -/* |
|---|
| 646 | | - * wanted, by virtue of open file modes AND cap refs (buffered/cached data) |
|---|
| 647 | | - */ |
|---|
| 648 | | -static inline int __ceph_caps_wanted(struct ceph_inode_info *ci) |
|---|
| 737 | +static inline bool __ceph_is_file_opened(struct ceph_inode_info *ci) |
|---|
| 649 | 738 | { |
|---|
| 650 | | - int w = __ceph_caps_file_wanted(ci) | __ceph_caps_used(ci); |
|---|
| 651 | | - if (w & CEPH_CAP_FILE_BUFFER) |
|---|
| 652 | | - w |= CEPH_CAP_FILE_EXCL; /* we want EXCL if dirty data */ |
|---|
| 653 | | - return w; |
|---|
| 739 | + return ci->i_nr_by_mode[0]; |
|---|
| 654 | 740 | } |
|---|
| 741 | +extern int __ceph_caps_file_wanted(struct ceph_inode_info *ci); |
|---|
| 742 | +extern int __ceph_caps_wanted(struct ceph_inode_info *ci); |
|---|
| 655 | 743 | |
|---|
| 656 | 744 | /* what the mds thinks we want */ |
|---|
| 657 | 745 | extern int __ceph_caps_mds_wanted(struct ceph_inode_info *ci, bool check); |
|---|
| 658 | 746 | |
|---|
| 659 | 747 | extern void ceph_caps_init(struct ceph_mds_client *mdsc); |
|---|
| 660 | 748 | extern void ceph_caps_finalize(struct ceph_mds_client *mdsc); |
|---|
| 661 | | -extern void ceph_adjust_min_caps(struct ceph_mds_client *mdsc, int delta); |
|---|
| 749 | +extern void ceph_adjust_caps_max_min(struct ceph_mds_client *mdsc, |
|---|
| 750 | + struct ceph_mount_options *fsopt); |
|---|
| 662 | 751 | extern int ceph_reserve_caps(struct ceph_mds_client *mdsc, |
|---|
| 663 | 752 | struct ceph_cap_reservation *ctx, int need); |
|---|
| 664 | 753 | extern void ceph_unreserve_caps(struct ceph_mds_client *mdsc, |
|---|
| .. | .. |
|---|
| 681 | 770 | |
|---|
| 682 | 771 | spinlock_t rw_contexts_lock; |
|---|
| 683 | 772 | struct list_head rw_contexts; |
|---|
| 773 | + |
|---|
| 774 | + u32 filp_gen; |
|---|
| 684 | 775 | }; |
|---|
| 685 | 776 | |
|---|
| 686 | 777 | struct ceph_dir_file_info { |
|---|
| .. | .. |
|---|
| 812 | 903 | * This allows larger machines to have larger/more transfers. |
|---|
| 813 | 904 | * Limit the default to 256M |
|---|
| 814 | 905 | */ |
|---|
| 815 | | - congestion_kb = (16*int_sqrt(totalram_pages)) << (PAGE_SHIFT-10); |
|---|
| 906 | + congestion_kb = (16*int_sqrt(totalram_pages())) << (PAGE_SHIFT-10); |
|---|
| 816 | 907 | if (congestion_kb > 256*1024) |
|---|
| 817 | 908 | congestion_kb = 256*1024; |
|---|
| 818 | 909 | |
|---|
| .. | .. |
|---|
| 820 | 911 | } |
|---|
| 821 | 912 | |
|---|
| 822 | 913 | |
|---|
| 823 | | - |
|---|
| 914 | +/* super.c */ |
|---|
| 915 | +extern int ceph_force_reconnect(struct super_block *sb); |
|---|
| 824 | 916 | /* snap.c */ |
|---|
| 825 | 917 | struct ceph_snap_realm *ceph_lookup_snap_realm(struct ceph_mds_client *mdsc, |
|---|
| 826 | 918 | u64 ino); |
|---|
| .. | .. |
|---|
| 839 | 931 | struct ceph_cap_snap *capsnap); |
|---|
| 840 | 932 | extern void ceph_cleanup_empty_realms(struct ceph_mds_client *mdsc); |
|---|
| 841 | 933 | |
|---|
| 934 | +extern struct ceph_snapid_map *ceph_get_snapid_map(struct ceph_mds_client *mdsc, |
|---|
| 935 | + u64 snap); |
|---|
| 936 | +extern void ceph_put_snapid_map(struct ceph_mds_client* mdsc, |
|---|
| 937 | + struct ceph_snapid_map *sm); |
|---|
| 938 | +extern void ceph_trim_snapid_map(struct ceph_mds_client *mdsc); |
|---|
| 939 | +extern void ceph_cleanup_snapid_map(struct ceph_mds_client *mdsc); |
|---|
| 940 | + |
|---|
| 941 | + |
|---|
| 842 | 942 | /* |
|---|
| 843 | 943 | * a cap_snap is "pending" if it is still awaiting an in-progress |
|---|
| 844 | 944 | * sync write (that may/may not still update size, mtime, etc.). |
|---|
| .. | .. |
|---|
| 851 | 951 | } |
|---|
| 852 | 952 | |
|---|
| 853 | 953 | /* inode.c */ |
|---|
| 954 | +struct ceph_mds_reply_info_in; |
|---|
| 955 | +struct ceph_mds_reply_dirfrag; |
|---|
| 956 | + |
|---|
| 854 | 957 | extern const struct inode_operations ceph_file_iops; |
|---|
| 855 | 958 | |
|---|
| 856 | 959 | extern struct inode *ceph_alloc_inode(struct super_block *sb); |
|---|
| 857 | 960 | extern void ceph_evict_inode(struct inode *inode); |
|---|
| 858 | | -extern void ceph_destroy_inode(struct inode *inode); |
|---|
| 859 | | -extern int ceph_drop_inode(struct inode *inode); |
|---|
| 961 | +extern void ceph_free_inode(struct inode *inode); |
|---|
| 860 | 962 | |
|---|
| 861 | 963 | extern struct inode *ceph_get_inode(struct super_block *sb, |
|---|
| 862 | 964 | struct ceph_vino vino); |
|---|
| .. | .. |
|---|
| 867 | 969 | u64 time_warp_seq, struct timespec64 *ctime, |
|---|
| 868 | 970 | struct timespec64 *mtime, |
|---|
| 869 | 971 | struct timespec64 *atime); |
|---|
| 972 | +extern int ceph_fill_inode(struct inode *inode, struct page *locked_page, |
|---|
| 973 | + struct ceph_mds_reply_info_in *iinfo, |
|---|
| 974 | + struct ceph_mds_reply_dirfrag *dirinfo, |
|---|
| 975 | + struct ceph_mds_session *session, int cap_fmode, |
|---|
| 976 | + struct ceph_cap_reservation *caps_reservation); |
|---|
| 870 | 977 | extern int ceph_fill_trace(struct super_block *sb, |
|---|
| 871 | 978 | struct ceph_mds_request *req); |
|---|
| 872 | 979 | extern int ceph_readdir_prepopulate(struct ceph_mds_request *req, |
|---|
| .. | .. |
|---|
| 877 | 984 | extern bool ceph_inode_set_size(struct inode *inode, loff_t size); |
|---|
| 878 | 985 | extern void __ceph_do_pending_vmtruncate(struct inode *inode); |
|---|
| 879 | 986 | extern void ceph_queue_vmtruncate(struct inode *inode); |
|---|
| 880 | | - |
|---|
| 881 | 987 | extern void ceph_queue_invalidate(struct inode *inode); |
|---|
| 882 | 988 | extern void ceph_queue_writeback(struct inode *inode); |
|---|
| 989 | +extern void ceph_async_iput(struct inode *inode); |
|---|
| 883 | 990 | |
|---|
| 884 | 991 | extern int __ceph_do_getattr(struct inode *inode, struct page *locked_page, |
|---|
| 885 | 992 | int mask, bool force); |
|---|
| .. | .. |
|---|
| 899 | 1006 | extern ssize_t ceph_listxattr(struct dentry *, char *, size_t); |
|---|
| 900 | 1007 | extern struct ceph_buffer *__ceph_build_xattrs_blob(struct ceph_inode_info *ci); |
|---|
| 901 | 1008 | extern void __ceph_destroy_xattrs(struct ceph_inode_info *ci); |
|---|
| 902 | | -extern void __init ceph_xattr_init(void); |
|---|
| 903 | | -extern void ceph_xattr_exit(void); |
|---|
| 904 | 1009 | extern const struct xattr_handler *ceph_xattr_handlers[]; |
|---|
| 1010 | + |
|---|
| 1011 | +struct ceph_acl_sec_ctx { |
|---|
| 1012 | +#ifdef CONFIG_CEPH_FS_POSIX_ACL |
|---|
| 1013 | + void *default_acl; |
|---|
| 1014 | + void *acl; |
|---|
| 1015 | +#endif |
|---|
| 1016 | +#ifdef CONFIG_CEPH_FS_SECURITY_LABEL |
|---|
| 1017 | + void *sec_ctx; |
|---|
| 1018 | + u32 sec_ctxlen; |
|---|
| 1019 | +#endif |
|---|
| 1020 | + struct ceph_pagelist *pagelist; |
|---|
| 1021 | +}; |
|---|
| 905 | 1022 | |
|---|
| 906 | 1023 | #ifdef CONFIG_SECURITY |
|---|
| 907 | 1024 | extern bool ceph_security_xattr_deadlock(struct inode *in); |
|---|
| .. | .. |
|---|
| 917 | 1034 | } |
|---|
| 918 | 1035 | #endif |
|---|
| 919 | 1036 | |
|---|
| 920 | | -/* acl.c */ |
|---|
| 921 | | -struct ceph_acls_info { |
|---|
| 922 | | - void *default_acl; |
|---|
| 923 | | - void *acl; |
|---|
| 924 | | - struct ceph_pagelist *pagelist; |
|---|
| 925 | | -}; |
|---|
| 1037 | +#ifdef CONFIG_CEPH_FS_SECURITY_LABEL |
|---|
| 1038 | +extern int ceph_security_init_secctx(struct dentry *dentry, umode_t mode, |
|---|
| 1039 | + struct ceph_acl_sec_ctx *ctx); |
|---|
| 1040 | +static inline void ceph_security_invalidate_secctx(struct inode *inode) |
|---|
| 1041 | +{ |
|---|
| 1042 | + security_inode_invalidate_secctx(inode); |
|---|
| 1043 | +} |
|---|
| 1044 | +#else |
|---|
| 1045 | +static inline int ceph_security_init_secctx(struct dentry *dentry, umode_t mode, |
|---|
| 1046 | + struct ceph_acl_sec_ctx *ctx) |
|---|
| 1047 | +{ |
|---|
| 1048 | + return 0; |
|---|
| 1049 | +} |
|---|
| 1050 | +static inline void ceph_security_invalidate_secctx(struct inode *inode) |
|---|
| 1051 | +{ |
|---|
| 1052 | +} |
|---|
| 1053 | +#endif |
|---|
| 926 | 1054 | |
|---|
| 1055 | +void ceph_release_acl_sec_ctx(struct ceph_acl_sec_ctx *as_ctx); |
|---|
| 1056 | + |
|---|
| 1057 | +/* acl.c */ |
|---|
| 927 | 1058 | #ifdef CONFIG_CEPH_FS_POSIX_ACL |
|---|
| 928 | 1059 | |
|---|
| 929 | 1060 | struct posix_acl *ceph_get_acl(struct inode *, int); |
|---|
| 930 | 1061 | int ceph_set_acl(struct inode *inode, struct posix_acl *acl, int type); |
|---|
| 931 | 1062 | int ceph_pre_init_acls(struct inode *dir, umode_t *mode, |
|---|
| 932 | | - struct ceph_acls_info *info); |
|---|
| 933 | | -void ceph_init_inode_acls(struct inode *inode, struct ceph_acls_info *info); |
|---|
| 934 | | -void ceph_release_acls_info(struct ceph_acls_info *info); |
|---|
| 1063 | + struct ceph_acl_sec_ctx *as_ctx); |
|---|
| 1064 | +void ceph_init_inode_acls(struct inode *inode, |
|---|
| 1065 | + struct ceph_acl_sec_ctx *as_ctx); |
|---|
| 935 | 1066 | |
|---|
| 936 | 1067 | static inline void ceph_forget_all_cached_acls(struct inode *inode) |
|---|
| 937 | 1068 | { |
|---|
| .. | .. |
|---|
| 944 | 1075 | #define ceph_set_acl NULL |
|---|
| 945 | 1076 | |
|---|
| 946 | 1077 | static inline int ceph_pre_init_acls(struct inode *dir, umode_t *mode, |
|---|
| 947 | | - struct ceph_acls_info *info) |
|---|
| 1078 | + struct ceph_acl_sec_ctx *as_ctx) |
|---|
| 948 | 1079 | { |
|---|
| 949 | 1080 | return 0; |
|---|
| 950 | 1081 | } |
|---|
| 951 | 1082 | static inline void ceph_init_inode_acls(struct inode *inode, |
|---|
| 952 | | - struct ceph_acls_info *info) |
|---|
| 953 | | -{ |
|---|
| 954 | | -} |
|---|
| 955 | | -static inline void ceph_release_acls_info(struct ceph_acls_info *info) |
|---|
| 1083 | + struct ceph_acl_sec_ctx *as_ctx) |
|---|
| 956 | 1084 | { |
|---|
| 957 | 1085 | } |
|---|
| 958 | 1086 | static inline int ceph_acl_chmod(struct dentry *dentry, struct inode *inode) |
|---|
| .. | .. |
|---|
| 974 | 1102 | struct ceph_cap_reservation *ctx); |
|---|
| 975 | 1103 | extern void ceph_add_cap(struct inode *inode, |
|---|
| 976 | 1104 | struct ceph_mds_session *session, u64 cap_id, |
|---|
| 977 | | - int fmode, unsigned issued, unsigned wanted, |
|---|
| 1105 | + unsigned issued, unsigned wanted, |
|---|
| 978 | 1106 | unsigned cap, unsigned seq, u64 realmino, int flags, |
|---|
| 979 | 1107 | struct ceph_cap **new_cap); |
|---|
| 980 | 1108 | extern void __ceph_remove_cap(struct ceph_cap *cap, bool queue_release); |
|---|
| 1109 | +extern void __ceph_remove_caps(struct ceph_inode_info *ci); |
|---|
| 981 | 1110 | extern void ceph_put_cap(struct ceph_mds_client *mdsc, |
|---|
| 982 | 1111 | struct ceph_cap *cap); |
|---|
| 983 | 1112 | extern int ceph_is_any_caps(struct inode *inode); |
|---|
| 984 | 1113 | |
|---|
| 985 | | -extern void ceph_queue_caps_release(struct inode *inode); |
|---|
| 986 | 1114 | extern int ceph_write_inode(struct inode *inode, struct writeback_control *wbc); |
|---|
| 987 | 1115 | extern int ceph_fsync(struct file *file, loff_t start, loff_t end, |
|---|
| 988 | 1116 | int datasync); |
|---|
| .. | .. |
|---|
| 990 | 1118 | struct ceph_mds_session *session); |
|---|
| 991 | 1119 | extern void ceph_kick_flushing_caps(struct ceph_mds_client *mdsc, |
|---|
| 992 | 1120 | struct ceph_mds_session *session); |
|---|
| 1121 | +void ceph_kick_flushing_inode_caps(struct ceph_mds_session *session, |
|---|
| 1122 | + struct ceph_inode_info *ci); |
|---|
| 993 | 1123 | extern struct ceph_cap *ceph_get_cap_for_mds(struct ceph_inode_info *ci, |
|---|
| 994 | 1124 | int mds); |
|---|
| 995 | | -extern int ceph_get_cap_mds(struct inode *inode); |
|---|
| 1125 | +extern void ceph_take_cap_refs(struct ceph_inode_info *ci, int caps, |
|---|
| 1126 | + bool snap_rwsem_locked); |
|---|
| 996 | 1127 | extern void ceph_get_cap_refs(struct ceph_inode_info *ci, int caps); |
|---|
| 997 | 1128 | extern void ceph_put_cap_refs(struct ceph_inode_info *ci, int had); |
|---|
| 1129 | +extern void ceph_put_cap_refs_no_check_caps(struct ceph_inode_info *ci, |
|---|
| 1130 | + int had); |
|---|
| 998 | 1131 | extern void ceph_put_wrbuffer_cap_refs(struct ceph_inode_info *ci, int nr, |
|---|
| 999 | 1132 | struct ceph_snap_context *snapc); |
|---|
| 1133 | +extern void __ceph_remove_capsnap(struct inode *inode, |
|---|
| 1134 | + struct ceph_cap_snap *capsnap, |
|---|
| 1135 | + bool *wake_ci, bool *wake_mdsc); |
|---|
| 1136 | +extern void ceph_remove_capsnap(struct inode *inode, |
|---|
| 1137 | + struct ceph_cap_snap *capsnap, |
|---|
| 1138 | + bool *wake_ci, bool *wake_mdsc); |
|---|
| 1000 | 1139 | extern void ceph_flush_snaps(struct ceph_inode_info *ci, |
|---|
| 1001 | 1140 | struct ceph_mds_session **psession); |
|---|
| 1002 | 1141 | extern bool __ceph_should_report_size(struct ceph_inode_info *ci); |
|---|
| 1003 | 1142 | extern void ceph_check_caps(struct ceph_inode_info *ci, int flags, |
|---|
| 1004 | 1143 | struct ceph_mds_session *session); |
|---|
| 1005 | | -extern void ceph_check_delayed_caps(struct ceph_mds_client *mdsc); |
|---|
| 1144 | +extern unsigned long ceph_check_delayed_caps(struct ceph_mds_client *mdsc); |
|---|
| 1006 | 1145 | extern void ceph_flush_dirty_caps(struct ceph_mds_client *mdsc); |
|---|
| 1007 | 1146 | extern int ceph_drop_caps_for_unlink(struct inode *inode); |
|---|
| 1008 | 1147 | extern int ceph_encode_inode_release(void **p, struct inode *inode, |
|---|
| .. | .. |
|---|
| 1011 | 1150 | struct inode *dir, |
|---|
| 1012 | 1151 | int mds, int drop, int unless); |
|---|
| 1013 | 1152 | |
|---|
| 1014 | | -extern int ceph_get_caps(struct ceph_inode_info *ci, int need, int want, |
|---|
| 1153 | +extern int ceph_get_caps(struct file *filp, int need, int want, |
|---|
| 1015 | 1154 | loff_t endoff, int *got, struct page **pinned_page); |
|---|
| 1016 | | -extern int ceph_try_get_caps(struct ceph_inode_info *ci, |
|---|
| 1017 | | - int need, int want, int *got); |
|---|
| 1155 | +extern int ceph_try_get_caps(struct inode *inode, |
|---|
| 1156 | + int need, int want, bool nonblock, int *got); |
|---|
| 1018 | 1157 | |
|---|
| 1019 | 1158 | /* for counting open files by mode */ |
|---|
| 1020 | | -extern void __ceph_get_fmode(struct ceph_inode_info *ci, int mode); |
|---|
| 1021 | | -extern void ceph_put_fmode(struct ceph_inode_info *ci, int mode); |
|---|
| 1159 | +extern void ceph_get_fmode(struct ceph_inode_info *ci, int mode, int count); |
|---|
| 1160 | +extern void ceph_put_fmode(struct ceph_inode_info *ci, int mode, int count); |
|---|
| 1161 | +extern void __ceph_touch_fmode(struct ceph_inode_info *ci, |
|---|
| 1162 | + struct ceph_mds_client *mdsc, int fmode); |
|---|
| 1022 | 1163 | |
|---|
| 1023 | 1164 | /* addr.c */ |
|---|
| 1024 | 1165 | extern const struct address_space_operations ceph_aops; |
|---|
| 1025 | 1166 | extern int ceph_mmap(struct file *file, struct vm_area_struct *vma); |
|---|
| 1026 | 1167 | extern int ceph_uninline_data(struct file *filp, struct page *locked_page); |
|---|
| 1027 | | -extern int ceph_pool_perm_check(struct ceph_inode_info *ci, int need); |
|---|
| 1168 | +extern int ceph_pool_perm_check(struct inode *inode, int need); |
|---|
| 1028 | 1169 | extern void ceph_pool_perm_destroy(struct ceph_mds_client* mdsc); |
|---|
| 1029 | 1170 | |
|---|
| 1030 | 1171 | /* file.c */ |
|---|
| 1031 | 1172 | extern const struct file_operations ceph_file_fops; |
|---|
| 1032 | 1173 | |
|---|
| 1033 | | -extern int ceph_renew_caps(struct inode *inode); |
|---|
| 1174 | +extern int ceph_renew_caps(struct inode *inode, int fmode); |
|---|
| 1034 | 1175 | extern int ceph_open(struct inode *inode, struct file *file); |
|---|
| 1035 | 1176 | extern int ceph_atomic_open(struct inode *dir, struct dentry *dentry, |
|---|
| 1036 | 1177 | struct file *file, unsigned flags, umode_t mode); |
|---|
| .. | .. |
|---|
| 1052 | 1193 | extern struct dentry *ceph_finish_lookup(struct ceph_mds_request *req, |
|---|
| 1053 | 1194 | struct dentry *dentry, int err); |
|---|
| 1054 | 1195 | |
|---|
| 1055 | | -extern void ceph_dentry_lru_add(struct dentry *dn); |
|---|
| 1056 | | -extern void ceph_dentry_lru_touch(struct dentry *dn); |
|---|
| 1057 | | -extern void ceph_dentry_lru_del(struct dentry *dn); |
|---|
| 1196 | +extern void __ceph_dentry_lease_touch(struct ceph_dentry_info *di); |
|---|
| 1197 | +extern void __ceph_dentry_dir_lease_touch(struct ceph_dentry_info *di); |
|---|
| 1058 | 1198 | extern void ceph_invalidate_dentry_lease(struct dentry *dentry); |
|---|
| 1199 | +extern int ceph_trim_dentries(struct ceph_mds_client *mdsc); |
|---|
| 1059 | 1200 | extern unsigned ceph_dentry_hash(struct inode *dir, struct dentry *dn); |
|---|
| 1060 | 1201 | extern void ceph_readdir_cache_release(struct ceph_readdir_cache_control *ctl); |
|---|
| 1061 | 1202 | |
|---|
| .. | .. |
|---|
| 1064 | 1205 | |
|---|
| 1065 | 1206 | /* export.c */ |
|---|
| 1066 | 1207 | extern const struct export_operations ceph_export_ops; |
|---|
| 1208 | +struct inode *ceph_lookup_inode(struct super_block *sb, u64 ino); |
|---|
| 1067 | 1209 | |
|---|
| 1068 | 1210 | /* locks.c */ |
|---|
| 1069 | 1211 | extern __init void ceph_flock_init(void); |
|---|
| .. | .. |
|---|
| 1079 | 1221 | int num_fcntl_locks, int num_flock_locks); |
|---|
| 1080 | 1222 | |
|---|
| 1081 | 1223 | /* debugfs.c */ |
|---|
| 1082 | | -extern int ceph_fs_debugfs_init(struct ceph_fs_client *client); |
|---|
| 1224 | +extern void ceph_fs_debugfs_init(struct ceph_fs_client *client); |
|---|
| 1083 | 1225 | extern void ceph_fs_debugfs_cleanup(struct ceph_fs_client *client); |
|---|
| 1084 | 1226 | |
|---|
| 1085 | 1227 | /* quota.c */ |
|---|
| .. | .. |
|---|
| 1107 | 1249 | struct ceph_mds_session *session, |
|---|
| 1108 | 1250 | struct ceph_msg *msg); |
|---|
| 1109 | 1251 | extern bool ceph_quota_is_max_files_exceeded(struct inode *inode); |
|---|
| 1110 | | -extern bool ceph_quota_is_same_realm(struct inode *old, struct inode *new); |
|---|
| 1111 | 1252 | extern bool ceph_quota_is_max_bytes_exceeded(struct inode *inode, |
|---|
| 1112 | 1253 | loff_t newlen); |
|---|
| 1113 | 1254 | extern bool ceph_quota_is_max_bytes_approaching(struct inode *inode, |
|---|
| 1114 | 1255 | loff_t newlen); |
|---|
| 1115 | 1256 | extern bool ceph_quota_update_statfs(struct ceph_fs_client *fsc, |
|---|
| 1116 | 1257 | struct kstatfs *buf); |
|---|
| 1258 | +extern int ceph_quota_check_rename(struct ceph_mds_client *mdsc, |
|---|
| 1259 | + struct inode *old, struct inode *new); |
|---|
| 1260 | +extern void ceph_cleanup_quotarealms_inodes(struct ceph_mds_client *mdsc); |
|---|
| 1117 | 1261 | |
|---|
| 1118 | 1262 | #endif /* _FS_CEPH_SUPER_H */ |
|---|