Skip to content

Commit f232ab0

Browse files
lorddoskiaskdave
authored andcommitted
btrfs: Explicitly reserve space for devreplace item
Part of device replace involves writing an item to the device root containing information about pending replace operations. Currently space for this item is not being explicitly reserved so this works thanks to presence of global reserve. While not fatal it's not a good practice. Let's be explicit about space requirement of device replace and reserve space when starting the transaction. Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> 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 fa19452 commit f232ab0

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎fs/btrfs/dev-replace.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -477,8 +477,8 @@ static int btrfs_dev_replace_start(struct btrfs_fs_info *fs_info,
477477

478478
btrfs_wait_ordered_roots(fs_info, U64_MAX, 0, (u64)-1);
479479

480-
/* force writing the updated state information to disk */
481-
trans = btrfs_start_transaction(root, 0);
480+
/* Commit dev_replace state and reserve 1 item for it. */
481+
trans = btrfs_start_transaction(root, 1);
482482
if (IS_ERR(trans)) {
483483
ret = PTR_ERR(trans);
484484
down_write(&dev_replace->rwsem);

0 commit comments

Comments
 (0)