Skip to content

Commit 4c6d1d8

Browse files
committed
btrfs: move struct io_ctl into ctree.h and rename it
We'll need to put the io_ctl into the block_group cache struct, so name it struct btrfs_io_ctl and move it into ctree.h Signed-off-by: Chris Mason <[email protected]>
1 parent 3bce876 commit 4c6d1d8

File tree

2 files changed

+33
-33
lines changed

2 files changed

+33
-33
lines changed

fs/btrfs/ctree.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1256,6 +1256,17 @@ struct btrfs_caching_control {
12561256
atomic_t count;
12571257
};
12581258

1259+
struct btrfs_io_ctl {
1260+
void *cur, *orig;
1261+
struct page *page;
1262+
struct page **pages;
1263+
struct btrfs_root *root;
1264+
unsigned long size;
1265+
int index;
1266+
int num_pages;
1267+
unsigned check_crcs:1;
1268+
};
1269+
12591270
struct btrfs_block_group_cache {
12601271
struct btrfs_key key;
12611272
struct btrfs_block_group_item item;

fs/btrfs/free-space-cache.c

Lines changed: 22 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -271,18 +271,7 @@ static int readahead_cache(struct inode *inode)
271271
return 0;
272272
}
273273

274-
struct io_ctl {
275-
void *cur, *orig;
276-
struct page *page;
277-
struct page **pages;
278-
struct btrfs_root *root;
279-
unsigned long size;
280-
int index;
281-
int num_pages;
282-
unsigned check_crcs:1;
283-
};
284-
285-
static int io_ctl_init(struct io_ctl *io_ctl, struct inode *inode,
274+
static int io_ctl_init(struct btrfs_io_ctl *io_ctl, struct inode *inode,
286275
struct btrfs_root *root, int write)
287276
{
288277
int num_pages;
@@ -298,7 +287,7 @@ static int io_ctl_init(struct io_ctl *io_ctl, struct inode *inode,
298287
(num_pages * sizeof(u32)) >= PAGE_CACHE_SIZE)
299288
return -ENOSPC;
300289

301-
memset(io_ctl, 0, sizeof(struct io_ctl));
290+
memset(io_ctl, 0, sizeof(struct btrfs_io_ctl));
302291

303292
io_ctl->pages = kcalloc(num_pages, sizeof(struct page *), GFP_NOFS);
304293
if (!io_ctl->pages)
@@ -311,12 +300,12 @@ static int io_ctl_init(struct io_ctl *io_ctl, struct inode *inode,
311300
return 0;
312301
}
313302

314-
static void io_ctl_free(struct io_ctl *io_ctl)
303+
static void io_ctl_free(struct btrfs_io_ctl *io_ctl)
315304
{
316305
kfree(io_ctl->pages);
317306
}
318307

319-
static void io_ctl_unmap_page(struct io_ctl *io_ctl)
308+
static void io_ctl_unmap_page(struct btrfs_io_ctl *io_ctl)
320309
{
321310
if (io_ctl->cur) {
322311
kunmap(io_ctl->page);
@@ -325,7 +314,7 @@ static void io_ctl_unmap_page(struct io_ctl *io_ctl)
325314
}
326315
}
327316

328-
static void io_ctl_map_page(struct io_ctl *io_ctl, int clear)
317+
static void io_ctl_map_page(struct btrfs_io_ctl *io_ctl, int clear)
329318
{
330319
ASSERT(io_ctl->index < io_ctl->num_pages);
331320
io_ctl->page = io_ctl->pages[io_ctl->index++];
@@ -336,7 +325,7 @@ static void io_ctl_map_page(struct io_ctl *io_ctl, int clear)
336325
memset(io_ctl->cur, 0, PAGE_CACHE_SIZE);
337326
}
338327

339-
static void io_ctl_drop_pages(struct io_ctl *io_ctl)
328+
static void io_ctl_drop_pages(struct btrfs_io_ctl *io_ctl)
340329
{
341330
int i;
342331

@@ -351,7 +340,7 @@ static void io_ctl_drop_pages(struct io_ctl *io_ctl)
351340
}
352341
}
353342

354-
static int io_ctl_prepare_pages(struct io_ctl *io_ctl, struct inode *inode,
343+
static int io_ctl_prepare_pages(struct btrfs_io_ctl *io_ctl, struct inode *inode,
355344
int uptodate)
356345
{
357346
struct page *page;
@@ -385,7 +374,7 @@ static int io_ctl_prepare_pages(struct io_ctl *io_ctl, struct inode *inode,
385374
return 0;
386375
}
387376

388-
static void io_ctl_set_generation(struct io_ctl *io_ctl, u64 generation)
377+
static void io_ctl_set_generation(struct btrfs_io_ctl *io_ctl, u64 generation)
389378
{
390379
__le64 *val;
391380

@@ -408,7 +397,7 @@ static void io_ctl_set_generation(struct io_ctl *io_ctl, u64 generation)
408397
io_ctl->cur += sizeof(u64);
409398
}
410399

411-
static int io_ctl_check_generation(struct io_ctl *io_ctl, u64 generation)
400+
static int io_ctl_check_generation(struct btrfs_io_ctl *io_ctl, u64 generation)
412401
{
413402
__le64 *gen;
414403

@@ -437,7 +426,7 @@ static int io_ctl_check_generation(struct io_ctl *io_ctl, u64 generation)
437426
return 0;
438427
}
439428

440-
static void io_ctl_set_crc(struct io_ctl *io_ctl, int index)
429+
static void io_ctl_set_crc(struct btrfs_io_ctl *io_ctl, int index)
441430
{
442431
u32 *tmp;
443432
u32 crc = ~(u32)0;
@@ -461,7 +450,7 @@ static void io_ctl_set_crc(struct io_ctl *io_ctl, int index)
461450
kunmap(io_ctl->pages[0]);
462451
}
463452

464-
static int io_ctl_check_crc(struct io_ctl *io_ctl, int index)
453+
static int io_ctl_check_crc(struct btrfs_io_ctl *io_ctl, int index)
465454
{
466455
u32 *tmp, val;
467456
u32 crc = ~(u32)0;
@@ -494,7 +483,7 @@ static int io_ctl_check_crc(struct io_ctl *io_ctl, int index)
494483
return 0;
495484
}
496485

497-
static int io_ctl_add_entry(struct io_ctl *io_ctl, u64 offset, u64 bytes,
486+
static int io_ctl_add_entry(struct btrfs_io_ctl *io_ctl, u64 offset, u64 bytes,
498487
void *bitmap)
499488
{
500489
struct btrfs_free_space_entry *entry;
@@ -524,7 +513,7 @@ static int io_ctl_add_entry(struct io_ctl *io_ctl, u64 offset, u64 bytes,
524513
return 0;
525514
}
526515

527-
static int io_ctl_add_bitmap(struct io_ctl *io_ctl, void *bitmap)
516+
static int io_ctl_add_bitmap(struct btrfs_io_ctl *io_ctl, void *bitmap)
528517
{
529518
if (!io_ctl->cur)
530519
return -ENOSPC;
@@ -547,7 +536,7 @@ static int io_ctl_add_bitmap(struct io_ctl *io_ctl, void *bitmap)
547536
return 0;
548537
}
549538

550-
static void io_ctl_zero_remaining_pages(struct io_ctl *io_ctl)
539+
static void io_ctl_zero_remaining_pages(struct btrfs_io_ctl *io_ctl)
551540
{
552541
/*
553542
* If we're not on the boundary we know we've modified the page and we
@@ -564,7 +553,7 @@ static void io_ctl_zero_remaining_pages(struct io_ctl *io_ctl)
564553
}
565554
}
566555

567-
static int io_ctl_read_entry(struct io_ctl *io_ctl,
556+
static int io_ctl_read_entry(struct btrfs_io_ctl *io_ctl,
568557
struct btrfs_free_space *entry, u8 *type)
569558
{
570559
struct btrfs_free_space_entry *e;
@@ -591,7 +580,7 @@ static int io_ctl_read_entry(struct io_ctl *io_ctl,
591580
return 0;
592581
}
593582

594-
static int io_ctl_read_bitmap(struct io_ctl *io_ctl,
583+
static int io_ctl_read_bitmap(struct btrfs_io_ctl *io_ctl,
595584
struct btrfs_free_space *entry)
596585
{
597586
int ret;
@@ -650,7 +639,7 @@ static int __load_free_space_cache(struct btrfs_root *root, struct inode *inode,
650639
{
651640
struct btrfs_free_space_header *header;
652641
struct extent_buffer *leaf;
653-
struct io_ctl io_ctl;
642+
struct btrfs_io_ctl io_ctl;
654643
struct btrfs_key key;
655644
struct btrfs_free_space *e, *n;
656645
LIST_HEAD(bitmaps);
@@ -879,7 +868,7 @@ int load_free_space_cache(struct btrfs_fs_info *fs_info,
879868
}
880869

881870
static noinline_for_stack
882-
int write_cache_extent_entries(struct io_ctl *io_ctl,
871+
int write_cache_extent_entries(struct btrfs_io_ctl *io_ctl,
883872
struct btrfs_free_space_ctl *ctl,
884873
struct btrfs_block_group_cache *block_group,
885874
int *entries, int *bitmaps,
@@ -1002,7 +991,7 @@ update_cache_item(struct btrfs_trans_handle *trans,
1002991
static noinline_for_stack int
1003992
write_pinned_extent_entries(struct btrfs_root *root,
1004993
struct btrfs_block_group_cache *block_group,
1005-
struct io_ctl *io_ctl,
994+
struct btrfs_io_ctl *io_ctl,
1006995
int *entries)
1007996
{
1008997
u64 start, extent_start, extent_end, len;
@@ -1052,7 +1041,7 @@ write_pinned_extent_entries(struct btrfs_root *root,
10521041
}
10531042

10541043
static noinline_for_stack int
1055-
write_bitmap_entries(struct io_ctl *io_ctl, struct list_head *bitmap_list)
1044+
write_bitmap_entries(struct btrfs_io_ctl *io_ctl, struct list_head *bitmap_list)
10561045
{
10571046
struct list_head *pos, *n;
10581047
int ret;
@@ -1086,7 +1075,7 @@ static int flush_dirty_cache(struct inode *inode)
10861075

10871076
static void noinline_for_stack
10881077
cleanup_write_cache_enospc(struct inode *inode,
1089-
struct io_ctl *io_ctl,
1078+
struct btrfs_io_ctl *io_ctl,
10901079
struct extent_state **cached_state,
10911080
struct list_head *bitmap_list)
10921081
{
@@ -1123,7 +1112,7 @@ static int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode,
11231112
struct btrfs_path *path, u64 offset)
11241113
{
11251114
struct extent_state *cached_state = NULL;
1126-
struct io_ctl io_ctl;
1115+
struct btrfs_io_ctl io_ctl;
11271116
LIST_HEAD(bitmap_list);
11281117
int entries = 0;
11291118
int bitmaps = 0;

0 commit comments

Comments
 (0)