aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r--fs/btrfs/ctree.h58
1 files changed, 38 insertions, 20 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 444b3e9b92a4..746a7248678e 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -26,6 +26,7 @@
26#include <linux/completion.h> 26#include <linux/completion.h>
27#include <linux/backing-dev.h> 27#include <linux/backing-dev.h>
28#include <linux/wait.h> 28#include <linux/wait.h>
29#include <linux/slab.h>
29#include <asm/kmap_types.h> 30#include <asm/kmap_types.h>
30#include "extent_io.h" 31#include "extent_io.h"
31#include "extent_map.h" 32#include "extent_map.h"
@@ -310,6 +311,9 @@ struct btrfs_header {
310#define BTRFS_MAX_INLINE_DATA_SIZE(r) (BTRFS_LEAF_DATA_SIZE(r) - \ 311#define BTRFS_MAX_INLINE_DATA_SIZE(r) (BTRFS_LEAF_DATA_SIZE(r) - \
311 sizeof(struct btrfs_item) - \ 312 sizeof(struct btrfs_item) - \
312 sizeof(struct btrfs_file_extent_item)) 313 sizeof(struct btrfs_file_extent_item))
314#define BTRFS_MAX_XATTR_SIZE(r) (BTRFS_LEAF_DATA_SIZE(r) - \
315 sizeof(struct btrfs_item) -\
316 sizeof(struct btrfs_dir_item))
313 317
314 318
315/* 319/*
@@ -370,11 +374,13 @@ struct btrfs_super_block {
370 * ones specified below then we will fail to mount 374 * ones specified below then we will fail to mount
371 */ 375 */
372#define BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF (1ULL << 0) 376#define BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF (1ULL << 0)
377#define BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL (2ULL << 0)
373 378
374#define BTRFS_FEATURE_COMPAT_SUPP 0ULL 379#define BTRFS_FEATURE_COMPAT_SUPP 0ULL
375#define BTRFS_FEATURE_COMPAT_RO_SUPP 0ULL 380#define BTRFS_FEATURE_COMPAT_RO_SUPP 0ULL
376#define BTRFS_FEATURE_INCOMPAT_SUPP \ 381#define BTRFS_FEATURE_INCOMPAT_SUPP \
377 BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF 382 (BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF | \
383 BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL)
378 384
379/* 385/*
380 * A leaf is full of items. offset and size tell us where to find 386 * A leaf is full of items. offset and size tell us where to find
@@ -829,7 +835,6 @@ struct btrfs_fs_info {
829 u64 last_trans_log_full_commit; 835 u64 last_trans_log_full_commit;
830 u64 open_ioctl_trans; 836 u64 open_ioctl_trans;
831 unsigned long mount_opt; 837 unsigned long mount_opt;
832 u64 max_extent;
833 u64 max_inline; 838 u64 max_inline;
834 u64 alloc_start; 839 u64 alloc_start;
835 struct btrfs_transaction *running_transaction; 840 struct btrfs_transaction *running_transaction;
@@ -859,8 +864,9 @@ struct btrfs_fs_info {
859 struct mutex ordered_operations_mutex; 864 struct mutex ordered_operations_mutex;
860 struct rw_semaphore extent_commit_sem; 865 struct rw_semaphore extent_commit_sem;
861 866
862 struct rw_semaphore subvol_sem; 867 struct rw_semaphore cleanup_work_sem;
863 868
869 struct rw_semaphore subvol_sem;
864 struct srcu_struct subvol_srcu; 870 struct srcu_struct subvol_srcu;
865 871
866 struct list_head trans_list; 872 struct list_head trans_list;
@@ -868,6 +874,9 @@ struct btrfs_fs_info {
868 struct list_head dead_roots; 874 struct list_head dead_roots;
869 struct list_head caching_block_groups; 875 struct list_head caching_block_groups;
870 876
877 spinlock_t delayed_iput_lock;
878 struct list_head delayed_iputs;
879
871 atomic_t nr_async_submits; 880 atomic_t nr_async_submits;
872 atomic_t async_submit_draining; 881 atomic_t async_submit_draining;
873 atomic_t nr_async_bios; 882 atomic_t nr_async_bios;
@@ -1034,12 +1043,12 @@ struct btrfs_root {
1034 int ref_cows; 1043 int ref_cows;
1035 int track_dirty; 1044 int track_dirty;
1036 int in_radix; 1045 int in_radix;
1046 int clean_orphans;
1037 1047
1038 u64 defrag_trans_start; 1048 u64 defrag_trans_start;
1039 struct btrfs_key defrag_progress; 1049 struct btrfs_key defrag_progress;
1040 struct btrfs_key defrag_max; 1050 struct btrfs_key defrag_max;
1041 int defrag_running; 1051 int defrag_running;
1042 int defrag_level;
1043 char *name; 1052 char *name;
1044 int in_sysfs; 1053 int in_sysfs;
1045 1054
@@ -1154,6 +1163,7 @@ struct btrfs_root {
1154#define BTRFS_MOUNT_SSD_SPREAD (1 << 8) 1163#define BTRFS_MOUNT_SSD_SPREAD (1 << 8)
1155#define BTRFS_MOUNT_NOSSD (1 << 9) 1164#define BTRFS_MOUNT_NOSSD (1 << 9)
1156#define BTRFS_MOUNT_DISCARD (1 << 10) 1165#define BTRFS_MOUNT_DISCARD (1 << 10)
1166#define BTRFS_MOUNT_FORCE_COMPRESS (1 << 11)
1157 1167
1158#define btrfs_clear_opt(o, opt) ((o) &= ~BTRFS_MOUNT_##opt) 1168#define btrfs_clear_opt(o, opt) ((o) &= ~BTRFS_MOUNT_##opt)
1159#define btrfs_set_opt(o, opt) ((o) |= BTRFS_MOUNT_##opt) 1169#define btrfs_set_opt(o, opt) ((o) |= BTRFS_MOUNT_##opt)
@@ -1174,7 +1184,6 @@ struct btrfs_root {
1174#define BTRFS_INODE_NOATIME (1 << 9) 1184#define BTRFS_INODE_NOATIME (1 << 9)
1175#define BTRFS_INODE_DIRSYNC (1 << 10) 1185#define BTRFS_INODE_DIRSYNC (1 << 10)
1176 1186
1177
1178/* some macros to generate set/get funcs for the struct fields. This 1187/* some macros to generate set/get funcs for the struct fields. This
1179 * assumes there is a lefoo_to_cpu for every type, so lets make a simple 1188 * assumes there is a lefoo_to_cpu for every type, so lets make a simple
1180 * one for u8: 1189 * one for u8:
@@ -1834,7 +1843,7 @@ BTRFS_SETGET_STACK_FUNCS(super_num_devices, struct btrfs_super_block,
1834BTRFS_SETGET_STACK_FUNCS(super_compat_flags, struct btrfs_super_block, 1843BTRFS_SETGET_STACK_FUNCS(super_compat_flags, struct btrfs_super_block,
1835 compat_flags, 64); 1844 compat_flags, 64);
1836BTRFS_SETGET_STACK_FUNCS(super_compat_ro_flags, struct btrfs_super_block, 1845BTRFS_SETGET_STACK_FUNCS(super_compat_ro_flags, struct btrfs_super_block,
1837 compat_flags, 64); 1846 compat_ro_flags, 64);
1838BTRFS_SETGET_STACK_FUNCS(super_incompat_flags, struct btrfs_super_block, 1847BTRFS_SETGET_STACK_FUNCS(super_incompat_flags, struct btrfs_super_block,
1839 incompat_flags, 64); 1848 incompat_flags, 64);
1840BTRFS_SETGET_STACK_FUNCS(super_csum_type, struct btrfs_super_block, 1849BTRFS_SETGET_STACK_FUNCS(super_csum_type, struct btrfs_super_block,
@@ -1975,6 +1984,10 @@ struct extent_buffer *btrfs_alloc_free_block(struct btrfs_trans_handle *trans,
1975 u64 parent, u64 root_objectid, 1984 u64 parent, u64 root_objectid,
1976 struct btrfs_disk_key *key, int level, 1985 struct btrfs_disk_key *key, int level,
1977 u64 hint, u64 empty_size); 1986 u64 hint, u64 empty_size);
1987int btrfs_free_tree_block(struct btrfs_trans_handle *trans,
1988 struct btrfs_root *root,
1989 u64 bytenr, u32 blocksize,
1990 u64 parent, u64 root_objectid, int level);
1978struct extent_buffer *btrfs_init_new_buffer(struct btrfs_trans_handle *trans, 1991struct extent_buffer *btrfs_init_new_buffer(struct btrfs_trans_handle *trans,
1979 struct btrfs_root *root, 1992 struct btrfs_root *root,
1980 u64 bytenr, u32 blocksize, 1993 u64 bytenr, u32 blocksize,
@@ -2089,6 +2102,10 @@ int btrfs_split_item(struct btrfs_trans_handle *trans,
2089 struct btrfs_path *path, 2102 struct btrfs_path *path,
2090 struct btrfs_key *new_key, 2103 struct btrfs_key *new_key,
2091 unsigned long split_offset); 2104 unsigned long split_offset);
2105int btrfs_duplicate_item(struct btrfs_trans_handle *trans,
2106 struct btrfs_root *root,
2107 struct btrfs_path *path,
2108 struct btrfs_key *new_key);
2092int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root 2109int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root
2093 *root, struct btrfs_key *key, struct btrfs_path *p, int 2110 *root, struct btrfs_key *key, struct btrfs_path *p, int
2094 ins_len, int cow); 2111 ins_len, int cow);
@@ -2196,9 +2213,10 @@ int btrfs_delete_one_dir_name(struct btrfs_trans_handle *trans,
2196 struct btrfs_path *path, 2213 struct btrfs_path *path,
2197 struct btrfs_dir_item *di); 2214 struct btrfs_dir_item *di);
2198int btrfs_insert_xattr_item(struct btrfs_trans_handle *trans, 2215int btrfs_insert_xattr_item(struct btrfs_trans_handle *trans,
2199 struct btrfs_root *root, const char *name, 2216 struct btrfs_root *root,
2200 u16 name_len, const void *data, u16 data_len, 2217 struct btrfs_path *path, u64 objectid,
2201 u64 dir); 2218 const char *name, u16 name_len,
2219 const void *data, u16 data_len);
2202struct btrfs_dir_item *btrfs_lookup_xattr(struct btrfs_trans_handle *trans, 2220struct btrfs_dir_item *btrfs_lookup_xattr(struct btrfs_trans_handle *trans,
2203 struct btrfs_root *root, 2221 struct btrfs_root *root,
2204 struct btrfs_path *path, u64 dir, 2222 struct btrfs_path *path, u64 dir,
@@ -2292,8 +2310,9 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
2292 struct inode *inode, u64 new_size, 2310 struct inode *inode, u64 new_size,
2293 u32 min_type); 2311 u32 min_type);
2294 2312
2295int btrfs_start_delalloc_inodes(struct btrfs_root *root); 2313int btrfs_start_delalloc_inodes(struct btrfs_root *root, int delay_iput);
2296int btrfs_set_extent_delalloc(struct inode *inode, u64 start, u64 end); 2314int btrfs_set_extent_delalloc(struct inode *inode, u64 start, u64 end,
2315 struct extent_state **cached_state);
2297int btrfs_writepages(struct address_space *mapping, 2316int btrfs_writepages(struct address_space *mapping,
2298 struct writeback_control *wbc); 2317 struct writeback_control *wbc);
2299int btrfs_create_subvol_root(struct btrfs_trans_handle *trans, 2318int btrfs_create_subvol_root(struct btrfs_trans_handle *trans,
@@ -2309,7 +2328,7 @@ int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf);
2309int btrfs_readpage(struct file *file, struct page *page); 2328int btrfs_readpage(struct file *file, struct page *page);
2310void btrfs_delete_inode(struct inode *inode); 2329void btrfs_delete_inode(struct inode *inode);
2311void btrfs_put_inode(struct inode *inode); 2330void btrfs_put_inode(struct inode *inode);
2312int btrfs_write_inode(struct inode *inode, int wait); 2331int btrfs_write_inode(struct inode *inode, struct writeback_control *wbc);
2313void btrfs_dirty_inode(struct inode *inode); 2332void btrfs_dirty_inode(struct inode *inode);
2314struct inode *btrfs_alloc_inode(struct super_block *sb); 2333struct inode *btrfs_alloc_inode(struct super_block *sb);
2315void btrfs_destroy_inode(struct inode *inode); 2334void btrfs_destroy_inode(struct inode *inode);
@@ -2318,7 +2337,7 @@ int btrfs_init_cachep(void);
2318void btrfs_destroy_cachep(void); 2337void btrfs_destroy_cachep(void);
2319long btrfs_ioctl_trans_end(struct file *file); 2338long btrfs_ioctl_trans_end(struct file *file);
2320struct inode *btrfs_iget(struct super_block *s, struct btrfs_key *location, 2339struct inode *btrfs_iget(struct super_block *s, struct btrfs_key *location,
2321 struct btrfs_root *root); 2340 struct btrfs_root *root, int *was_new);
2322int btrfs_commit_write(struct file *file, struct page *page, 2341int btrfs_commit_write(struct file *file, struct page *page,
2323 unsigned from, unsigned to); 2342 unsigned from, unsigned to);
2324struct extent_map *btrfs_get_extent(struct inode *inode, struct page *page, 2343struct extent_map *btrfs_get_extent(struct inode *inode, struct page *page,
@@ -2332,6 +2351,8 @@ int btrfs_orphan_del(struct btrfs_trans_handle *trans, struct inode *inode);
2332void btrfs_orphan_cleanup(struct btrfs_root *root); 2351void btrfs_orphan_cleanup(struct btrfs_root *root);
2333int btrfs_cont_expand(struct inode *inode, loff_t size); 2352int btrfs_cont_expand(struct inode *inode, loff_t size);
2334int btrfs_invalidate_inodes(struct btrfs_root *root); 2353int btrfs_invalidate_inodes(struct btrfs_root *root);
2354void btrfs_add_delayed_iput(struct inode *inode);
2355void btrfs_run_delayed_iputs(struct btrfs_root *root);
2335extern const struct dentry_operations btrfs_dentry_operations; 2356extern const struct dentry_operations btrfs_dentry_operations;
2336 2357
2337/* ioctl.c */ 2358/* ioctl.c */
@@ -2345,12 +2366,9 @@ int btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end,
2345 int skip_pinned); 2366 int skip_pinned);
2346int btrfs_check_file(struct btrfs_root *root, struct inode *inode); 2367int btrfs_check_file(struct btrfs_root *root, struct inode *inode);
2347extern const struct file_operations btrfs_file_operations; 2368extern const struct file_operations btrfs_file_operations;
2348int btrfs_drop_extents(struct btrfs_trans_handle *trans, 2369int btrfs_drop_extents(struct btrfs_trans_handle *trans, struct inode *inode,
2349 struct btrfs_root *root, struct inode *inode, 2370 u64 start, u64 end, u64 *hint_byte, int drop_cache);
2350 u64 start, u64 end, u64 locked_end,
2351 u64 inline_limit, u64 *hint_block, int drop_cache);
2352int btrfs_mark_extent_written(struct btrfs_trans_handle *trans, 2371int btrfs_mark_extent_written(struct btrfs_trans_handle *trans,
2353 struct btrfs_root *root,
2354 struct inode *inode, u64 start, u64 end); 2372 struct inode *inode, u64 start, u64 end);
2355int btrfs_release_file(struct inode *inode, struct file *file); 2373int btrfs_release_file(struct inode *inode, struct file *file);
2356 2374
@@ -2370,7 +2388,6 @@ void btrfs_sysfs_del_super(struct btrfs_fs_info *root);
2370ssize_t btrfs_listxattr(struct dentry *dentry, char *buffer, size_t size); 2388ssize_t btrfs_listxattr(struct dentry *dentry, char *buffer, size_t size);
2371 2389
2372/* super.c */ 2390/* super.c */
2373u64 btrfs_parse_size(char *str);
2374int btrfs_parse_options(struct btrfs_root *root, char *options); 2391int btrfs_parse_options(struct btrfs_root *root, char *options);
2375int btrfs_sync_fs(struct super_block *sb, int wait); 2392int btrfs_sync_fs(struct super_block *sb, int wait);
2376 2393
@@ -2380,7 +2397,8 @@ int btrfs_check_acl(struct inode *inode, int mask);
2380#else 2397#else
2381#define btrfs_check_acl NULL 2398#define btrfs_check_acl NULL
2382#endif 2399#endif
2383int btrfs_init_acl(struct inode *inode, struct inode *dir); 2400int btrfs_init_acl(struct btrfs_trans_handle *trans,
2401 struct inode *inode, struct inode *dir);
2384int btrfs_acl_chmod(struct inode *inode); 2402int btrfs_acl_chmod(struct inode *inode);
2385 2403
2386/* relocation.c */ 2404/* relocation.c */