aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/ctree.h16
-rw-r--r--fs/btrfs/extent-tree.c5
-rw-r--r--fs/btrfs/super.c3
3 files changed, 3 insertions, 21 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 78248d57729..2d166ca8b10 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -152,9 +152,6 @@ struct btrfs_path {
152 int slots[BTRFS_MAX_LEVEL]; 152 int slots[BTRFS_MAX_LEVEL];
153}; 153};
154 154
155/* values for the type field in btrfs_extent_item */
156#define BTRFS_EXTENT_TREE 1
157#define BTRFS_EXTENT_FILE 2
158/* 155/*
159 * items in the extent btree are used to record the objectid of the 156 * items in the extent btree are used to record the objectid of the
160 * owner of the block and the number of references 157 * owner of the block and the number of references
@@ -162,7 +159,6 @@ struct btrfs_path {
162struct btrfs_extent_item { 159struct btrfs_extent_item {
163 __le32 refs; 160 __le32 refs;
164 __le64 owner; 161 __le64 owner;
165 u8 type;
166} __attribute__ ((__packed__)); 162} __attribute__ ((__packed__));
167 163
168struct btrfs_inode_timespec { 164struct btrfs_inode_timespec {
@@ -489,16 +485,6 @@ static inline void btrfs_set_extent_owner(struct btrfs_extent_item *ei, u64 val)
489 ei->owner = cpu_to_le64(val); 485 ei->owner = cpu_to_le64(val);
490} 486}
491 487
492static inline u8 btrfs_extent_type(struct btrfs_extent_item *ei)
493{
494 return ei->type;
495}
496
497static inline void btrfs_set_extent_type(struct btrfs_extent_item *ei, u8 val)
498{
499 ei->type = val;
500}
501
502static inline u64 btrfs_node_blockptr(struct btrfs_node *n, int nr) 488static inline u64 btrfs_node_blockptr(struct btrfs_node *n, int nr)
503{ 489{
504 return le64_to_cpu(n->ptrs[nr].blockptr); 490 return le64_to_cpu(n->ptrs[nr].blockptr);
@@ -1036,7 +1022,7 @@ struct buffer_head *btrfs_alloc_free_block(struct btrfs_trans_handle *trans,
1036 struct btrfs_root *root); 1022 struct btrfs_root *root);
1037int btrfs_alloc_extent(struct btrfs_trans_handle *trans, 1023int btrfs_alloc_extent(struct btrfs_trans_handle *trans,
1038 struct btrfs_root *root, u64 owner, 1024 struct btrfs_root *root, u64 owner,
1039 u8 type, u64 num_blocks, u64 search_start, 1025 u64 num_blocks, u64 search_start,
1040 u64 search_end, struct btrfs_key *ins); 1026 u64 search_end, struct btrfs_key *ins);
1041int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root, 1027int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
1042 struct buffer_head *buf); 1028 struct buffer_head *buf);
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index aac3eccffb8..116519503d0 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -167,7 +167,6 @@ static int finish_current_insert(struct btrfs_trans_handle *trans, struct
167 ins.offset = 1; 167 ins.offset = 1;
168 ins.flags = 0; 168 ins.flags = 0;
169 btrfs_set_key_type(&ins, BTRFS_EXTENT_ITEM_KEY); 169 btrfs_set_key_type(&ins, BTRFS_EXTENT_ITEM_KEY);
170 btrfs_set_extent_type(&extent_item, BTRFS_EXTENT_TREE);
171 btrfs_set_extent_owner(&extent_item, extent_root->root_key.objectid); 170 btrfs_set_extent_owner(&extent_item, extent_root->root_key.objectid);
172 171
173 for (i = 0; i < extent_root->fs_info->current_insert.flags; i++) { 172 for (i = 0; i < extent_root->fs_info->current_insert.flags; i++) {
@@ -464,7 +463,7 @@ error:
464 */ 463 */
465int btrfs_alloc_extent(struct btrfs_trans_handle *trans, 464int btrfs_alloc_extent(struct btrfs_trans_handle *trans,
466 struct btrfs_root *root, u64 owner, 465 struct btrfs_root *root, u64 owner,
467 u8 type, u64 num_blocks, u64 search_start, 466 u64 num_blocks, u64 search_start,
468 u64 search_end, struct btrfs_key *ins) 467 u64 search_end, struct btrfs_key *ins)
469{ 468{
470 int ret; 469 int ret;
@@ -476,7 +475,6 @@ int btrfs_alloc_extent(struct btrfs_trans_handle *trans,
476 475
477 btrfs_set_extent_refs(&extent_item, 1); 476 btrfs_set_extent_refs(&extent_item, 1);
478 btrfs_set_extent_owner(&extent_item, owner); 477 btrfs_set_extent_owner(&extent_item, owner);
479 btrfs_set_extent_type(&extent_item, type);
480 478
481 if (root == extent_root) { 479 if (root == extent_root) {
482 BUG_ON(extent_root->fs_info->current_insert.offset == 0); 480 BUG_ON(extent_root->fs_info->current_insert.offset == 0);
@@ -520,7 +518,6 @@ struct buffer_head *btrfs_alloc_free_block(struct btrfs_trans_handle *trans,
520 struct buffer_head *buf; 518 struct buffer_head *buf;
521 519
522 ret = btrfs_alloc_extent(trans, root, root->root_key.objectid, 520 ret = btrfs_alloc_extent(trans, root, root->root_key.objectid,
523 BTRFS_EXTENT_TREE,
524 1, 0, (unsigned long)-1, &ins); 521 1, 0, (unsigned long)-1, &ins);
525 if (ret) { 522 if (ret) {
526 BUG(); 523 BUG();
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 43f081593c4..c076474c8bf 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -1830,8 +1830,7 @@ static ssize_t btrfs_file_write(struct file *file, const char __user *buf,
1830 if (inode->i_size >= PAGE_CACHE_SIZE || pos + count < inode->i_size || 1830 if (inode->i_size >= PAGE_CACHE_SIZE || pos + count < inode->i_size ||
1831 pos + count - start_pos > BTRFS_MAX_INLINE_DATA_SIZE(root)) { 1831 pos + count - start_pos > BTRFS_MAX_INLINE_DATA_SIZE(root)) {
1832 ret = btrfs_alloc_extent(trans, root, inode->i_ino, 1832 ret = btrfs_alloc_extent(trans, root, inode->i_ino,
1833 BTRFS_EXTENT_FILE, num_blocks, 1, 1833 num_blocks, 1, (u64)-1, &ins);
1834 (u64)-1, &ins);
1835 BUG_ON(ret); 1834 BUG_ON(ret);
1836 ret = btrfs_insert_file_extent(trans, root, inode->i_ino, 1835 ret = btrfs_insert_file_extent(trans, root, inode->i_ino,
1837 start_pos, ins.objectid, ins.offset); 1836 start_pos, ins.objectid, ins.offset);