Skip to content

Commit ae0f162

Browse files
committed
btrfs: sink gfp parameter to clear_extent_bit
All callers use GFP_NOFS, we don't have to pass it as an argument. The built-in tests pass GFP_KERNEL, but they run only at module load time and NOFS works there as well. Signed-off-by: David Sterba <[email protected]>
1 parent 66b0c88 commit ae0f162

File tree

9 files changed

+30
-42
lines changed

9 files changed

+30
-42
lines changed

fs/btrfs/extent_io.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,10 +1295,10 @@ int set_record_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
12951295

12961296
int clear_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
12971297
unsigned bits, int wake, int delete,
1298-
struct extent_state **cached, gfp_t mask)
1298+
struct extent_state **cached)
12991299
{
13001300
return __clear_extent_bit(tree, start, end, bits, wake, delete,
1301-
cached, mask, NULL);
1301+
cached, GFP_NOFS, NULL);
13021302
}
13031303

13041304
int clear_record_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
@@ -1348,7 +1348,7 @@ int try_lock_extent(struct extent_io_tree *tree, u64 start, u64 end)
13481348
if (err == -EEXIST) {
13491349
if (failed_start > start)
13501350
clear_extent_bit(tree, start, failed_start - 1,
1351-
EXTENT_LOCKED, 1, 0, NULL, GFP_NOFS);
1351+
EXTENT_LOCKED, 1, 0, NULL);
13521352
return 0;
13531353
}
13541354
return 1;
@@ -1744,7 +1744,7 @@ void extent_clear_unlock_delalloc(struct inode *inode, u64 start, u64 end,
17441744
unsigned long page_ops)
17451745
{
17461746
clear_extent_bit(&BTRFS_I(inode)->io_tree, start, end, clear_bits, 1, 0,
1747-
NULL, GFP_NOFS);
1747+
NULL);
17481748

17491749
__process_pages_contig(inode->i_mapping, locked_page,
17501750
start >> PAGE_SHIFT, end >> PAGE_SHIFT,
@@ -4207,7 +4207,7 @@ int extent_invalidatepage(struct extent_io_tree *tree,
42074207
clear_extent_bit(tree, start, end,
42084208
EXTENT_LOCKED | EXTENT_DIRTY | EXTENT_DELALLOC |
42094209
EXTENT_DO_ACCOUNTING,
4210-
1, 1, &cached_state, GFP_NOFS);
4210+
1, 1, &cached_state);
42114211
return 0;
42124212
}
42134213

fs/btrfs/extent_io.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -300,16 +300,15 @@ int clear_record_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
300300
unsigned bits, struct extent_changeset *changeset);
301301
int clear_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
302302
unsigned bits, int wake, int delete,
303-
struct extent_state **cached, gfp_t mask);
303+
struct extent_state **cached);
304304
int __clear_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
305305
unsigned bits, int wake, int delete,
306306
struct extent_state **cached, gfp_t mask,
307307
struct extent_changeset *changeset);
308308

309309
static inline int unlock_extent(struct extent_io_tree *tree, u64 start, u64 end)
310310
{
311-
return clear_extent_bit(tree, start, end, EXTENT_LOCKED, 1, 0, NULL,
312-
GFP_NOFS);
311+
return clear_extent_bit(tree, start, end, EXTENT_LOCKED, 1, 0, NULL);
313312
}
314313

315314
static inline int unlock_extent_cached(struct extent_io_tree *tree, u64 start,
@@ -327,8 +326,7 @@ static inline int clear_extent_bits(struct extent_io_tree *tree, u64 start,
327326
if (bits & EXTENT_LOCKED)
328327
wake = 1;
329328

330-
return clear_extent_bit(tree, start, end, bits, wake, 0, NULL,
331-
GFP_NOFS);
329+
return clear_extent_bit(tree, start, end, bits, wake, 0, NULL);
332330
}
333331

334332
int set_record_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
@@ -362,7 +360,7 @@ static inline int clear_extent_dirty(struct extent_io_tree *tree, u64 start,
362360
{
363361
return clear_extent_bit(tree, start, end,
364362
EXTENT_DIRTY | EXTENT_DELALLOC |
365-
EXTENT_DO_ACCOUNTING, 0, 0, NULL, GFP_NOFS);
363+
EXTENT_DO_ACCOUNTING, 0, 0, NULL);
366364
}
367365

368366
int convert_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,

fs/btrfs/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1519,7 +1519,7 @@ lock_and_cleanup_extent_if_need(struct btrfs_inode *inode, struct page **pages,
15191519
clear_extent_bit(&inode->io_tree, start_pos, last_pos,
15201520
EXTENT_DIRTY | EXTENT_DELALLOC |
15211521
EXTENT_DO_ACCOUNTING | EXTENT_DEFRAG,
1522-
0, 0, cached_state, GFP_NOFS);
1522+
0, 0, cached_state);
15231523
*lockstart = start_pos;
15241524
*lockend = last_pos;
15251525
ret = 1;

fs/btrfs/free-space-cache.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -993,8 +993,7 @@ update_cache_item(struct btrfs_trans_handle *trans,
993993
ret = btrfs_search_slot(trans, root, &key, path, 0, 1);
994994
if (ret < 0) {
995995
clear_extent_bit(&BTRFS_I(inode)->io_tree, 0, inode->i_size - 1,
996-
EXTENT_DIRTY | EXTENT_DELALLOC, 0, 0, NULL,
997-
GFP_NOFS);
996+
EXTENT_DIRTY | EXTENT_DELALLOC, 0, 0, NULL);
998997
goto fail;
999998
}
1000999
leaf = path->nodes[0];
@@ -1008,7 +1007,7 @@ update_cache_item(struct btrfs_trans_handle *trans,
10081007
clear_extent_bit(&BTRFS_I(inode)->io_tree, 0,
10091008
inode->i_size - 1,
10101009
EXTENT_DIRTY | EXTENT_DELALLOC, 0, 0,
1011-
NULL, GFP_NOFS);
1010+
NULL);
10121011
btrfs_release_path(path);
10131012
goto fail;
10141013
}
@@ -1105,8 +1104,7 @@ static int flush_dirty_cache(struct inode *inode)
11051104
ret = btrfs_wait_ordered_range(inode, 0, (u64)-1);
11061105
if (ret)
11071106
clear_extent_bit(&BTRFS_I(inode)->io_tree, 0, inode->i_size - 1,
1108-
EXTENT_DIRTY | EXTENT_DELALLOC, 0, 0, NULL,
1109-
GFP_NOFS);
1107+
EXTENT_DIRTY | EXTENT_DELALLOC, 0, 0, NULL);
11101108

11111109
return ret;
11121110
}

fs/btrfs/inode.c

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,7 +1203,7 @@ static int cow_file_range_async(struct inode *inode, struct page *locked_page,
12031203
u64 cur_end;
12041204

12051205
clear_extent_bit(&BTRFS_I(inode)->io_tree, start, end, EXTENT_LOCKED,
1206-
1, 0, NULL, GFP_NOFS);
1206+
1, 0, NULL);
12071207
while (start < end) {
12081208
async_cow = kmalloc(sizeof(*async_cow), GFP_NOFS);
12091209
BUG_ON(!async_cow); /* -ENOMEM */
@@ -3000,7 +3000,7 @@ static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent)
30003000

30013001
clear_extent_bit(io_tree, ordered_extent->file_offset,
30023002
ordered_extent->file_offset + ordered_extent->len - 1,
3003-
EXTENT_DEFRAG, 0, 0, &cached_state, GFP_NOFS);
3003+
EXTENT_DEFRAG, 0, 0, &cached_state);
30043004
}
30053005

30063006
if (nolock)
@@ -3070,7 +3070,7 @@ static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent)
30703070
ordered_extent->len - 1,
30713071
clear_bits,
30723072
(clear_bits & EXTENT_LOCKED) ? 1 : 0,
3073-
0, &cached_state, GFP_NOFS);
3073+
0, &cached_state);
30743074
}
30753075

30763076
if (trans)
@@ -4812,7 +4812,7 @@ int btrfs_truncate_block(struct inode *inode, loff_t from, loff_t len,
48124812
clear_extent_bit(&BTRFS_I(inode)->io_tree, block_start, block_end,
48134813
EXTENT_DIRTY | EXTENT_DELALLOC |
48144814
EXTENT_DO_ACCOUNTING | EXTENT_DEFRAG,
4815-
0, 0, &cached_state, GFP_NOFS);
4815+
0, 0, &cached_state);
48164816

48174817
ret = btrfs_set_extent_delalloc(inode, block_start, block_end, 0,
48184818
&cached_state, 0);
@@ -5248,8 +5248,7 @@ static void evict_inode_truncate_pages(struct inode *inode)
52485248
clear_extent_bit(io_tree, start, end,
52495249
EXTENT_LOCKED | EXTENT_DIRTY |
52505250
EXTENT_DELALLOC | EXTENT_DO_ACCOUNTING |
5251-
EXTENT_DEFRAG, 1, 1,
5252-
&cached_state, GFP_NOFS);
5251+
EXTENT_DEFRAG, 1, 1, &cached_state);
52535252

52545253
cond_resched();
52555254
spin_lock(&io_tree->lock);
@@ -7936,7 +7935,7 @@ static int btrfs_get_blocks_direct(struct inode *inode, sector_t iblock,
79367935
if (lockstart < lockend) {
79377936
clear_extent_bit(&BTRFS_I(inode)->io_tree, lockstart,
79387937
lockend, unlock_bits, 1, 0,
7939-
&cached_state, GFP_NOFS);
7938+
&cached_state);
79407939
} else {
79417940
free_extent_state(cached_state);
79427941
}
@@ -7947,7 +7946,7 @@ static int btrfs_get_blocks_direct(struct inode *inode, sector_t iblock,
79477946

79487947
unlock_err:
79497948
clear_extent_bit(&BTRFS_I(inode)->io_tree, lockstart, lockend,
7950-
unlock_bits, 1, 0, &cached_state, GFP_NOFS);
7949+
unlock_bits, 1, 0, &cached_state);
79517950
err:
79527951
if (dio_data)
79537952
current->journal_info = dio_data;
@@ -8989,8 +8988,7 @@ static void btrfs_invalidatepage(struct page *page, unsigned int offset,
89898988
EXTENT_DIRTY | EXTENT_DELALLOC |
89908989
EXTENT_DELALLOC_NEW |
89918990
EXTENT_LOCKED | EXTENT_DO_ACCOUNTING |
8992-
EXTENT_DEFRAG, 1, 0, &cached_state,
8993-
GFP_NOFS);
8991+
EXTENT_DEFRAG, 1, 0, &cached_state);
89948992
/*
89958993
* whoever cleared the private bit is responsible
89968994
* for the finish_ordered_io
@@ -9047,7 +9045,7 @@ static void btrfs_invalidatepage(struct page *page, unsigned int offset,
90479045
EXTENT_LOCKED | EXTENT_DIRTY |
90489046
EXTENT_DELALLOC | EXTENT_DELALLOC_NEW |
90499047
EXTENT_DO_ACCOUNTING | EXTENT_DEFRAG, 1, 1,
9050-
&cached_state, GFP_NOFS);
9048+
&cached_state);
90519049

90529050
__btrfs_releasepage(page, GFP_NOFS);
90539051
}
@@ -9175,7 +9173,7 @@ int btrfs_page_mkwrite(struct vm_fault *vmf)
91759173
clear_extent_bit(&BTRFS_I(inode)->io_tree, page_start, end,
91769174
EXTENT_DIRTY | EXTENT_DELALLOC |
91779175
EXTENT_DO_ACCOUNTING | EXTENT_DEFRAG,
9178-
0, 0, &cached_state, GFP_NOFS);
9176+
0, 0, &cached_state);
91799177

91809178
ret = btrfs_set_extent_delalloc(inode, page_start, end, 0,
91819179
&cached_state, 0);

fs/btrfs/ioctl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1190,7 +1190,7 @@ static int cluster_pages_for_defrag(struct inode *inode,
11901190
clear_extent_bit(&BTRFS_I(inode)->io_tree, page_start,
11911191
page_end - 1, EXTENT_DIRTY | EXTENT_DELALLOC |
11921192
EXTENT_DO_ACCOUNTING | EXTENT_DEFRAG, 0, 0,
1193-
&cached_state, GFP_NOFS);
1193+
&cached_state);
11941194

11951195
if (i_done != page_cnt) {
11961196
spin_lock(&BTRFS_I(inode)->lock);

fs/btrfs/qgroup.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2883,8 +2883,7 @@ int btrfs_qgroup_reserve_data(struct inode *inode,
28832883
ULIST_ITER_INIT(&uiter);
28842884
while ((unode = ulist_next(&reserved->range_changed, &uiter)))
28852885
clear_extent_bit(&BTRFS_I(inode)->io_tree, unode->val,
2886-
unode->aux, EXTENT_QGROUP_RESERVED, 0, 0, NULL,
2887-
GFP_NOFS);
2886+
unode->aux, EXTENT_QGROUP_RESERVED, 0, 0, NULL);
28882887
extent_changeset_release(reserved);
28892888
return ret;
28902889
}

fs/btrfs/tests/inode-tests.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,8 +1001,7 @@ static int test_extent_accounting(u32 sectorsize, u32 nodesize)
10011001
BTRFS_MAX_EXTENT_SIZE >> 1,
10021002
(BTRFS_MAX_EXTENT_SIZE >> 1) + sectorsize - 1,
10031003
EXTENT_DELALLOC | EXTENT_DIRTY |
1004-
EXTENT_UPTODATE, 0, 0,
1005-
NULL, GFP_KERNEL);
1004+
EXTENT_UPTODATE, 0, 0, NULL);
10061005
if (ret) {
10071006
test_msg("clear_extent_bit returned %d\n", ret);
10081007
goto out;
@@ -1070,8 +1069,7 @@ static int test_extent_accounting(u32 sectorsize, u32 nodesize)
10701069
BTRFS_MAX_EXTENT_SIZE + sectorsize,
10711070
BTRFS_MAX_EXTENT_SIZE + 2 * sectorsize - 1,
10721071
EXTENT_DIRTY | EXTENT_DELALLOC |
1073-
EXTENT_UPTODATE, 0, 0,
1074-
NULL, GFP_KERNEL);
1072+
EXTENT_UPTODATE, 0, 0, NULL);
10751073
if (ret) {
10761074
test_msg("clear_extent_bit returned %d\n", ret);
10771075
goto out;
@@ -1104,8 +1102,7 @@ static int test_extent_accounting(u32 sectorsize, u32 nodesize)
11041102
/* Empty */
11051103
ret = clear_extent_bit(&BTRFS_I(inode)->io_tree, 0, (u64)-1,
11061104
EXTENT_DIRTY | EXTENT_DELALLOC |
1107-
EXTENT_UPTODATE, 0, 0,
1108-
NULL, GFP_KERNEL);
1105+
EXTENT_UPTODATE, 0, 0, NULL);
11091106
if (ret) {
11101107
test_msg("clear_extent_bit returned %d\n", ret);
11111108
goto out;
@@ -1121,8 +1118,7 @@ static int test_extent_accounting(u32 sectorsize, u32 nodesize)
11211118
if (ret)
11221119
clear_extent_bit(&BTRFS_I(inode)->io_tree, 0, (u64)-1,
11231120
EXTENT_DIRTY | EXTENT_DELALLOC |
1124-
EXTENT_UPTODATE, 0, 0,
1125-
NULL, GFP_KERNEL);
1121+
EXTENT_UPTODATE, 0, 0, NULL);
11261122
iput(inode);
11271123
btrfs_free_dummy_root(root);
11281124
btrfs_free_dummy_fs_info(fs_info);

fs/btrfs/transaction.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,8 +1016,7 @@ static int __btrfs_wait_marked_extents(struct btrfs_fs_info *fs_info,
10161016
* it's safe to do it (through clear_btree_io_tree()).
10171017
*/
10181018
err = clear_extent_bit(dirty_pages, start, end,
1019-
EXTENT_NEED_WAIT,
1020-
0, 0, &cached_state, GFP_NOFS);
1019+
EXTENT_NEED_WAIT, 0, 0, &cached_state);
10211020
if (err == -ENOMEM)
10221021
err = 0;
10231022
if (!err)

0 commit comments

Comments
 (0)