Skip to content

Commit 72c34e8

Browse files
committed
Merge tag 'for-5.8-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux
Pull btrfs fixes from David Sterba: "Two refcounting fixes and one prepartory patch for upcoming splice cleanup: - fix double put of block group with nodatacow - fix missing block group put when remounting with discard=async - explicitly set splice callback (no functional change), to ease integrating splice cleanup patches" * tag 'for-5.8-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux: btrfs: wire up iter_file_splice_write btrfs: fix double put of block group with nocow btrfs: discard: add missing put when grabbing block group from unused list
2 parents 9901a6b + d777659 commit 72c34e8

File tree

3 files changed

+3
-8
lines changed

3 files changed

+3
-8
lines changed

fs/btrfs/discard.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,7 @@ void btrfs_discard_punt_unused_bgs_list(struct btrfs_fs_info *fs_info)
619619
list_for_each_entry_safe(block_group, next, &fs_info->unused_bgs,
620620
bg_list) {
621621
list_del_init(&block_group->bg_list);
622+
btrfs_put_block_group(block_group);
622623
btrfs_discard_queue_work(&fs_info->discard_ctl, block_group);
623624
}
624625
spin_unlock(&fs_info->unused_bgs_lock);

fs/btrfs/file.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3509,6 +3509,7 @@ const struct file_operations btrfs_file_operations = {
35093509
.read_iter = generic_file_read_iter,
35103510
.splice_read = generic_file_splice_read,
35113511
.write_iter = btrfs_file_write_iter,
3512+
.splice_write = iter_file_splice_write,
35123513
.mmap = btrfs_file_mmap,
35133514
.open = btrfs_file_open,
35143515
.release = btrfs_release_file,

fs/btrfs/inode.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,12 +1690,8 @@ static noinline int run_delalloc_nocow(struct inode *inode,
16901690
ret = fallback_to_cow(inode, locked_page, cow_start,
16911691
found_key.offset - 1,
16921692
page_started, nr_written);
1693-
if (ret) {
1694-
if (nocow)
1695-
btrfs_dec_nocow_writers(fs_info,
1696-
disk_bytenr);
1693+
if (ret)
16971694
goto error;
1698-
}
16991695
cow_start = (u64)-1;
17001696
}
17011697

@@ -1711,9 +1707,6 @@ static noinline int run_delalloc_nocow(struct inode *inode,
17111707
ram_bytes, BTRFS_COMPRESS_NONE,
17121708
BTRFS_ORDERED_PREALLOC);
17131709
if (IS_ERR(em)) {
1714-
if (nocow)
1715-
btrfs_dec_nocow_writers(fs_info,
1716-
disk_bytenr);
17171710
ret = PTR_ERR(em);
17181711
goto error;
17191712
}

0 commit comments

Comments
 (0)