Skip to content

Commit f2a97a9

Browse files
committed
btrfs: remove all unused functions
Remove static and global declarations and/or definitions. Reduces size of btrfs.ko by ~3.4kB. text data bss dec hex filename 402081 7464 200 409745 64091 btrfs.ko.base 398620 7144 200 405964 631cc btrfs.ko.remove-all Signed-off-by: David Sterba <dsterba@suse.cz>
1 parent 621496f commit f2a97a9

19 files changed

Lines changed: 1 addition & 817 deletions

‎fs/btrfs/ctree.h‎

Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,26 +1440,12 @@ static inline u64 btrfs_stripe_offset_nr(struct extent_buffer *eb,
14401440
return btrfs_stripe_offset(eb, btrfs_stripe_nr(c, nr));
14411441
}
14421442

1443-
static inline void btrfs_set_stripe_offset_nr(struct extent_buffer *eb,
1444-
struct btrfs_chunk *c, int nr,
1445-
u64 val)
1446-
{
1447-
btrfs_set_stripe_offset(eb, btrfs_stripe_nr(c, nr), val);
1448-
}
1449-
14501443
static inline u64 btrfs_stripe_devid_nr(struct extent_buffer *eb,
14511444
struct btrfs_chunk *c, int nr)
14521445
{
14531446
return btrfs_stripe_devid(eb, btrfs_stripe_nr(c, nr));
14541447
}
14551448

1456-
static inline void btrfs_set_stripe_devid_nr(struct extent_buffer *eb,
1457-
struct btrfs_chunk *c, int nr,
1458-
u64 val)
1459-
{
1460-
btrfs_set_stripe_devid(eb, btrfs_stripe_nr(c, nr), val);
1461-
}
1462-
14631449
/* struct btrfs_block_group_item */
14641450
BTRFS_SETGET_STACK_FUNCS(block_group_used, struct btrfs_block_group_item,
14651451
used, 64);
@@ -1517,14 +1503,6 @@ btrfs_inode_ctime(struct btrfs_inode_item *inode_item)
15171503
return (struct btrfs_timespec *)ptr;
15181504
}
15191505

1520-
static inline struct btrfs_timespec *
1521-
btrfs_inode_otime(struct btrfs_inode_item *inode_item)
1522-
{
1523-
unsigned long ptr = (unsigned long)inode_item;
1524-
ptr += offsetof(struct btrfs_inode_item, otime);
1525-
return (struct btrfs_timespec *)ptr;
1526-
}
1527-
15281506
BTRFS_SETGET_FUNCS(timespec_sec, struct btrfs_timespec, sec, 64);
15291507
BTRFS_SETGET_FUNCS(timespec_nsec, struct btrfs_timespec, nsec, 32);
15301508

@@ -1875,33 +1853,6 @@ static inline u8 *btrfs_header_chunk_tree_uuid(struct extent_buffer *eb)
18751853
return (u8 *)ptr;
18761854
}
18771855

1878-
static inline u8 *btrfs_super_fsid(struct extent_buffer *eb)
1879-
{
1880-
unsigned long ptr = offsetof(struct btrfs_super_block, fsid);
1881-
return (u8 *)ptr;
1882-
}
1883-
1884-
static inline u8 *btrfs_header_csum(struct extent_buffer *eb)
1885-
{
1886-
unsigned long ptr = offsetof(struct btrfs_header, csum);
1887-
return (u8 *)ptr;
1888-
}
1889-
1890-
static inline struct btrfs_node *btrfs_buffer_node(struct extent_buffer *eb)
1891-
{
1892-
return NULL;
1893-
}
1894-
1895-
static inline struct btrfs_leaf *btrfs_buffer_leaf(struct extent_buffer *eb)
1896-
{
1897-
return NULL;
1898-
}
1899-
1900-
static inline struct btrfs_header *btrfs_buffer_header(struct extent_buffer *eb)
1901-
{
1902-
return NULL;
1903-
}
1904-
19051856
static inline int btrfs_is_leaf(struct extent_buffer *eb)
19061857
{
19071858
return btrfs_header_level(eb) == 0;
@@ -2055,22 +2006,6 @@ static inline struct btrfs_root *btrfs_sb(struct super_block *sb)
20552006
return sb->s_fs_info;
20562007
}
20572008

2058-
static inline int btrfs_set_root_name(struct btrfs_root *root,
2059-
const char *name, int len)
2060-
{
2061-
/* if we already have a name just free it */
2062-
kfree(root->name);
2063-
2064-
root->name = kmalloc(len+1, GFP_KERNEL);
2065-
if (!root->name)
2066-
return -ENOMEM;
2067-
2068-
memcpy(root->name, name, len);
2069-
root->name[len] = '\0';
2070-
2071-
return 0;
2072-
}
2073-
20742009
static inline u32 btrfs_level_size(struct btrfs_root *root, int level)
20752010
{
20762011
if (level == 0)
@@ -2304,11 +2239,6 @@ static inline int btrfs_del_item(struct btrfs_trans_handle *trans,
23042239

23052240
int btrfs_insert_item(struct btrfs_trans_handle *trans, struct btrfs_root
23062241
*root, struct btrfs_key *key, void *data, u32 data_size);
2307-
int btrfs_insert_some_items(struct btrfs_trans_handle *trans,
2308-
struct btrfs_root *root,
2309-
struct btrfs_path *path,
2310-
struct btrfs_key *cpu_key, u32 *data_size,
2311-
int nr);
23122242
int btrfs_insert_empty_items(struct btrfs_trans_handle *trans,
23132243
struct btrfs_root *root,
23142244
struct btrfs_path *path,
@@ -2354,8 +2284,6 @@ int btrfs_update_root(struct btrfs_trans_handle *trans, struct btrfs_root
23542284
*item);
23552285
int btrfs_find_last_root(struct btrfs_root *root, u64 objectid, struct
23562286
btrfs_root_item *item, struct btrfs_key *key);
2357-
int btrfs_search_root(struct btrfs_root *root, u64 search_start,
2358-
u64 *found_objectid);
23592287
int btrfs_find_dead_roots(struct btrfs_root *root, u64 objectid);
23602288
int btrfs_find_orphan_roots(struct btrfs_root *tree_root);
23612289
int btrfs_set_root_node(struct btrfs_root_item *item,
@@ -2494,8 +2422,6 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
24942422
u32 min_type);
24952423

24962424
int btrfs_start_delalloc_inodes(struct btrfs_root *root, int delay_iput);
2497-
int btrfs_start_one_delalloc_inode(struct btrfs_root *root, int delay_iput,
2498-
int sync);
24992425
int btrfs_set_extent_delalloc(struct inode *inode, u64 start, u64 end,
25002426
struct extent_state **cached_state);
25012427
int btrfs_writepages(struct address_space *mapping,
@@ -2579,10 +2505,6 @@ int btrfs_defrag_leaves(struct btrfs_trans_handle *trans,
25792505
/* sysfs.c */
25802506
int btrfs_init_sysfs(void);
25812507
void btrfs_exit_sysfs(void);
2582-
int btrfs_sysfs_add_super(struct btrfs_fs_info *fs);
2583-
int btrfs_sysfs_add_root(struct btrfs_root *root);
2584-
void btrfs_sysfs_del_root(struct btrfs_root *root);
2585-
void btrfs_sysfs_del_super(struct btrfs_fs_info *root);
25862508

25872509
/* xattr.c */
25882510
ssize_t btrfs_listxattr(struct dentry *dentry, char *buffer, size_t size);

‎fs/btrfs/delayed-ref.c‎

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -280,44 +280,6 @@ int btrfs_find_ref_cluster(struct btrfs_trans_handle *trans,
280280
return 1;
281281
}
282282

283-
/*
284-
* This checks to see if there are any delayed refs in the
285-
* btree for a given bytenr. It returns one if it finds any
286-
* and zero otherwise.
287-
*
288-
* If it only finds a head node, it returns 0.
289-
*
290-
* The idea is to use this when deciding if you can safely delete an
291-
* extent from the extent allocation tree. There may be a pending
292-
* ref in the rbtree that adds or removes references, so as long as this
293-
* returns one you need to leave the BTRFS_EXTENT_ITEM in the extent
294-
* allocation tree.
295-
*/
296-
int btrfs_delayed_ref_pending(struct btrfs_trans_handle *trans, u64 bytenr)
297-
{
298-
struct btrfs_delayed_ref_node *ref;
299-
struct btrfs_delayed_ref_root *delayed_refs;
300-
struct rb_node *prev_node;
301-
int ret = 0;
302-
303-
delayed_refs = &trans->transaction->delayed_refs;
304-
spin_lock(&delayed_refs->lock);
305-
306-
ref = find_ref_head(&delayed_refs->root, bytenr, NULL);
307-
if (ref) {
308-
prev_node = rb_prev(&ref->rb_node);
309-
if (!prev_node)
310-
goto out;
311-
ref = rb_entry(prev_node, struct btrfs_delayed_ref_node,
312-
rb_node);
313-
if (ref->bytenr == bytenr)
314-
ret = 1;
315-
}
316-
out:
317-
spin_unlock(&delayed_refs->lock);
318-
return ret;
319-
}
320-
321283
/*
322284
* helper function to update an extent delayed ref in the
323285
* rbtree. existing and update must both have the same

‎fs/btrfs/delayed-ref.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ int btrfs_add_delayed_extent_op(struct btrfs_trans_handle *trans,
166166

167167
struct btrfs_delayed_ref_head *
168168
btrfs_find_delayed_ref_head(struct btrfs_trans_handle *trans, u64 bytenr);
169-
int btrfs_delayed_ref_pending(struct btrfs_trans_handle *trans, u64 bytenr);
170169
int btrfs_delayed_ref_lock(struct btrfs_trans_handle *trans,
171170
struct btrfs_delayed_ref_head *head);
172171
int btrfs_find_ref_cluster(struct btrfs_trans_handle *trans,

‎fs/btrfs/disk-io.c‎

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -650,12 +650,6 @@ unsigned long btrfs_async_submit_limit(struct btrfs_fs_info *info)
650650
return 256 * limit;
651651
}
652652

653-
int btrfs_congested_async(struct btrfs_fs_info *info, int iodone)
654-
{
655-
return atomic_read(&info->nr_async_bios) >
656-
btrfs_async_submit_limit(info);
657-
}
658-
659653
static void run_one_async_start(struct btrfs_work *work)
660654
{
661655
struct async_submit_bio *async;
@@ -1283,21 +1277,6 @@ struct btrfs_root *btrfs_read_fs_root_no_radix(struct btrfs_root *tree_root,
12831277
return root;
12841278
}
12851279

1286-
struct btrfs_root *btrfs_lookup_fs_root(struct btrfs_fs_info *fs_info,
1287-
u64 root_objectid)
1288-
{
1289-
struct btrfs_root *root;
1290-
1291-
if (root_objectid == BTRFS_ROOT_TREE_OBJECTID)
1292-
return fs_info->tree_root;
1293-
if (root_objectid == BTRFS_EXTENT_TREE_OBJECTID)
1294-
return fs_info->extent_root;
1295-
1296-
root = radix_tree_lookup(&fs_info->fs_roots_radix,
1297-
(unsigned long)root_objectid);
1298-
return root;
1299-
}
1300-
13011280
struct btrfs_root *btrfs_read_fs_root_no_name(struct btrfs_fs_info *fs_info,
13021281
struct btrfs_key *location)
13031282
{
@@ -1369,11 +1348,6 @@ struct btrfs_root *btrfs_read_fs_root_no_name(struct btrfs_fs_info *fs_info,
13691348
return ERR_PTR(ret);
13701349
}
13711350

1372-
struct btrfs_root *btrfs_read_fs_root(struct btrfs_fs_info *fs_info,
1373-
struct btrfs_key *location,
1374-
const char *name, int namelen)
1375-
{
1376-
return btrfs_read_fs_root_no_name(fs_info, location);
13771351
#if 0
13781352
struct btrfs_root *root;
13791353
int ret;
@@ -1402,7 +1376,6 @@ struct btrfs_root *btrfs_read_fs_root(struct btrfs_fs_info *fs_info,
14021376
root->in_sysfs = 1;
14031377
return root;
14041378
#endif
1405-
}
14061379

14071380
static int btrfs_congested_fn(void *congested_data, int bdi_bits)
14081381
{

‎fs/btrfs/disk-io.h‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,6 @@ int btrfs_commit_super(struct btrfs_root *root);
5555
int btrfs_error_commit_super(struct btrfs_root *root);
5656
struct extent_buffer *btrfs_find_tree_block(struct btrfs_root *root,
5757
u64 bytenr, u32 blocksize);
58-
struct btrfs_root *btrfs_lookup_fs_root(struct btrfs_fs_info *fs_info,
59-
u64 root_objectid);
60-
struct btrfs_root *btrfs_read_fs_root(struct btrfs_fs_info *fs_info,
61-
struct btrfs_key *location,
62-
const char *name, int namelen);
6358
struct btrfs_root *btrfs_read_fs_root_no_radix(struct btrfs_root *tree_root,
6459
struct btrfs_key *location);
6560
struct btrfs_root *btrfs_read_fs_root_no_name(struct btrfs_fs_info *fs_info,
@@ -80,8 +75,6 @@ int btrfs_wq_submit_bio(struct btrfs_fs_info *fs_info, struct inode *inode,
8075
unsigned long bio_flags, u64 bio_offset,
8176
extent_submit_bio_hook_t *submit_bio_start,
8277
extent_submit_bio_hook_t *submit_bio_done);
83-
84-
int btrfs_congested_async(struct btrfs_fs_info *info, int iodone);
8578
unsigned long btrfs_async_submit_limit(struct btrfs_fs_info *info);
8679
int btrfs_write_tree_block(struct extent_buffer *buf);
8780
int btrfs_wait_tree_block_writeback(struct extent_buffer *buf);

0 commit comments

Comments
 (0)