Skip to content

Commit 905eb88

Browse files
lorddoskiaskdave
authored andcommitted
btrfs: remove struct extent_io_ops
It's no longer used just remove the function and any related code which was initialising it for inodes. No functional changes. Removing 8 bytes from extent_io_tree in turn reduces size of other structures where it is embedded, notably btrfs_inode where it reduces size by 24 bytes. Signed-off-by: Nikolay Borisov <nborisov@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 1b36294 commit 905eb88

7 files changed

Lines changed: 0 additions & 38 deletions

File tree

‎fs/btrfs/ctree.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3583,9 +3583,7 @@ static inline int btrfs_defrag_cancelled(struct btrfs_fs_info *fs_info)
35833583

35843584
/* Sanity test specific functions */
35853585
#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
3586-
void btrfs_test_inode_set_ops(struct inode *inode);
35873586
void btrfs_test_destroy_inode(struct inode *inode);
3588-
35893587
static inline int btrfs_is_testing(struct btrfs_fs_info *fs_info)
35903588
{
35913589
return test_bit(BTRFS_FS_STATE_DUMMY_FS_INFO, &fs_info->fs_state);

‎fs/btrfs/disk-io.c‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
BTRFS_SUPER_FLAG_METADUMP |\
5151
BTRFS_SUPER_FLAG_METADUMP_V2)
5252

53-
static const struct extent_io_ops btree_extent_io_ops;
5453
static void end_workqueue_fn(struct btrfs_work *work);
5554
static void btrfs_destroy_ordered_extents(struct btrfs_root *root);
5655
static int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans,
@@ -2065,8 +2064,6 @@ static void btrfs_init_btree_inode(struct btrfs_fs_info *fs_info)
20652064
BTRFS_I(inode)->io_tree.track_uptodate = false;
20662065
extent_map_tree_init(&BTRFS_I(inode)->extent_tree);
20672066

2068-
BTRFS_I(inode)->io_tree.ops = &btree_extent_io_ops;
2069-
20702067
BTRFS_I(inode)->root = btrfs_grab_root(fs_info->tree_root);
20712068
memset(&BTRFS_I(inode)->location, 0, sizeof(struct btrfs_key));
20722069
set_bit(BTRFS_INODE_DUMMY, &BTRFS_I(inode)->runtime_flags);
@@ -4633,7 +4630,3 @@ static int btrfs_cleanup_transaction(struct btrfs_fs_info *fs_info)
46334630

46344631
return 0;
46354632
}
4636-
4637-
static const struct extent_io_ops btree_extent_io_ops = {
4638-
.submit_bio_hook = NULL
4639-
};

‎fs/btrfs/extent-io-tree.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ struct extent_io_tree {
6363
u8 owner;
6464

6565
spinlock_t lock;
66-
const struct extent_io_ops *ops;
6766
};
6867

6968
struct extent_state {

‎fs/btrfs/extent_io.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,6 @@ void extent_io_tree_init(struct btrfs_fs_info *fs_info,
281281
{
282282
tree->fs_info = fs_info;
283283
tree->state = RB_ROOT;
284-
tree->ops = NULL;
285284
tree->dirty_bytes = 0;
286285
spin_lock_init(&tree->lock);
287286
tree->private_data = private_data;
@@ -3055,7 +3054,6 @@ static int submit_extent_page(unsigned int opf,
30553054
else
30563055
contig = bio_end_sector(bio) == sector;
30573056

3058-
ASSERT(tree->ops);
30593057
if (btrfs_bio_fits_in_stripe(page, page_size, bio, bio_flags))
30603058
can_merge = false;
30613059

‎fs/btrfs/extent_io.h‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,6 @@ typedef blk_status_t (submit_bio_hook_t)(struct inode *inode, struct bio *bio,
7474
typedef blk_status_t (extent_submit_bio_start_t)(void *private_data,
7575
struct bio *bio, u64 bio_offset);
7676

77-
struct extent_io_ops {
78-
/*
79-
* The following callback must be always defined, the function
80-
* pointer will be called unconditionally.
81-
*/
82-
submit_bio_hook_t *submit_bio_hook;
83-
};
84-
85-
8677
#define INLINE_EXTENT_BUFFER_PAGES 16
8778
#define MAX_INLINE_EXTENT_BUFFER_SIZE (INLINE_EXTENT_BUFFER_PAGES * PAGE_SIZE)
8879
struct extent_buffer {

‎fs/btrfs/inode.c‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ static const struct inode_operations btrfs_special_inode_operations;
7171
static const struct inode_operations btrfs_file_inode_operations;
7272
static const struct address_space_operations btrfs_aops;
7373
static const struct file_operations btrfs_dir_file_operations;
74-
static const struct extent_io_ops btrfs_extent_io_ops;
7574

7675
static struct kmem_cache *btrfs_inode_cachep;
7776
struct kmem_cache *btrfs_trans_handle_cachep;
@@ -141,13 +140,6 @@ static inline void btrfs_cleanup_ordered_extents(struct btrfs_inode *inode,
141140

142141
static int btrfs_dirty_inode(struct inode *inode);
143142

144-
#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
145-
void btrfs_test_inode_set_ops(struct inode *inode)
146-
{
147-
BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops;
148-
}
149-
#endif
150-
151143
static int btrfs_init_inode_security(struct btrfs_trans_handle *trans,
152144
struct inode *inode, struct inode *dir,
153145
const struct qstr *qstr)
@@ -3391,7 +3383,6 @@ static int btrfs_read_locked_inode(struct inode *inode,
33913383
switch (inode->i_mode & S_IFMT) {
33923384
case S_IFREG:
33933385
inode->i_mapping->a_ops = &btrfs_aops;
3394-
BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops;
33953386
inode->i_fop = &btrfs_file_operations;
33963387
inode->i_op = &btrfs_file_inode_operations;
33973388
break;
@@ -6307,7 +6298,6 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry,
63076298
if (err)
63086299
goto out_unlock;
63096300

6310-
BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops;
63116301
d_instantiate_new(dentry, inode);
63126302

63136303
out_unlock:
@@ -9518,7 +9508,6 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry,
95189508
inode->i_fop = &btrfs_file_operations;
95199509
inode->i_op = &btrfs_file_inode_operations;
95209510
inode->i_mapping->a_ops = &btrfs_aops;
9521-
BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops;
95229511

95239512
err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name);
95249513
if (err)
@@ -9838,7 +9827,6 @@ static int btrfs_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode)
98389827
inode->i_op = &btrfs_file_inode_operations;
98399828

98409829
inode->i_mapping->a_ops = &btrfs_aops;
9841-
BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops;
98429830

98439831
ret = btrfs_init_inode_security(trans, inode, dir, NULL);
98449832
if (ret)
@@ -10256,10 +10244,6 @@ static const struct file_operations btrfs_dir_file_operations = {
1025610244
.fsync = btrfs_sync_file,
1025710245
};
1025810246

10259-
static const struct extent_io_ops btrfs_extent_io_ops = {
10260-
.submit_bio_hook = NULL
10261-
};
10262-
1026310247
/*
1026410248
* btrfs doesn't support the bmap operation because swapfiles
1026510249
* use bmap to make a mapping of extents in the file. They assume

‎fs/btrfs/tests/inode-tests.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -949,7 +949,6 @@ static int test_extent_accounting(u32 sectorsize, u32 nodesize)
949949
}
950950

951951
BTRFS_I(inode)->root = root;
952-
btrfs_test_inode_set_ops(inode);
953952

954953
/* [BTRFS_MAX_EXTENT_SIZE] */
955954
ret = btrfs_set_extent_delalloc(BTRFS_I(inode), 0,

0 commit comments

Comments
 (0)