Skip to content

Commit 9f2e3a5

Browse files
committed
Merge tag 'for-5.2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux
Pull btrfs updates from David Sterba: "This time the majority of changes are cleanups, though there's still a number of changes of user interest. User visible changes: - better read time and write checks to catch errors early and before writing data to disk (to catch potential memory corruption on data that get checksummed) - qgroups + metadata relocation: last speed up patch int the series to address the slowness, there should be no overhead comparing balance with and without qgroups - FIEMAP ioctl does not start a transaction unnecessarily, this can result in a speed up and less blocking due to IO - LOGICAL_INO (v1, v2) does not start transaction unnecessarily, this can speed up the mentioned ioctl and scrub as well - fsync on files with many (but not too many) hardlinks is faster, finer decision if the links should be fsynced individually or completely - send tries harder to find ranges to clone - trim/discard will skip unallocated chunks that haven't been touched since the last mount Fixes: - send flushes delayed allocation before start, otherwise it could miss some changes in case of a very recent rw->ro switch of a subvolume - fix fallocate with qgroups that could lead to space accounting underflow, reported as a warning - trim/discard ioctl honours the requested range - starting send and dedupe on a subvolume at the same time will let only one of them succeed, this is to prevent changes that send could miss due to dedupe; both operations are restartable Core changes: - more tree-checker validations, errors reported by fuzzing tools: - device item - inode item - block group profiles - tracepoints for extent buffer locking - async cow preallocates memory to avoid errors happening too deep in the call chain - metadata reservations for delalloc reworked to better adapt in many-writers/low-space scenarios - improved space flushing logic for intense DIO vs buffered workloads - lots of cleanups - removed unused struct members - redundant argument removal - properties and xattrs - extent buffer locking - selftests - use common file type conversions - many-argument functions reduction" * tag 'for-5.2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux: (227 commits) btrfs: Use kvmalloc for allocating compressed path context btrfs: Factor out common extent locking code in submit_compressed_extents btrfs: Set io_tree only once in submit_compressed_extents btrfs: Replace clear_extent_bit with unlock_extent btrfs: Make compress_file_range take only struct async_chunk btrfs: Remove fs_info from struct async_chunk btrfs: Rename async_cow to async_chunk btrfs: Preallocate chunks in cow_file_range_async btrfs: reserve delalloc metadata differently btrfs: track DIO bytes in flight btrfs: merge calls of btrfs_setxattr and btrfs_setxattr_trans in btrfs_set_prop btrfs: delete unused function btrfs_set_prop_trans btrfs: start transaction in xattr_handler_set_prop btrfs: drop local copy of inode i_mode btrfs: drop old_fsflags in btrfs_ioctl_setflags btrfs: modify local copy of btrfs_inode flags btrfs: drop useless inode i_flags copy and restore btrfs: start transaction in btrfs_ioctl_setflags() btrfs: export btrfs_set_prop btrfs: refactor btrfs_set_props to validate externally ...
2 parents 78438ce + b1c16ac commit 9f2e3a5

64 files changed

Lines changed: 3287 additions & 2194 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎fs/btrfs/acl.c‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,11 @@ static int __btrfs_set_acl(struct btrfs_trans_handle *trans,
9393
goto out;
9494
}
9595

96-
ret = btrfs_setxattr(trans, inode, name, value, size, 0);
96+
if (trans)
97+
ret = btrfs_setxattr(trans, inode, name, value, size, 0);
98+
else
99+
ret = btrfs_setxattr_trans(inode, name, value, size, 0);
100+
97101
out:
98102
kfree(value);
99103

‎fs/btrfs/backref.c‎

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ static int add_delayed_refs(const struct btrfs_fs_info *fs_info,
791791
count = node->ref_mod * -1;
792792
break;
793793
default:
794-
BUG_ON(1);
794+
BUG();
795795
}
796796
*total_refs += count;
797797
switch (node->type) {
@@ -1460,8 +1460,8 @@ int btrfs_find_all_roots(struct btrfs_trans_handle *trans,
14601460
* callers (such as fiemap) which want to know whether the extent is
14611461
* shared but do not need a ref count.
14621462
*
1463-
* This attempts to allocate a transaction in order to account for
1464-
* delayed refs, but continues on even when the alloc fails.
1463+
* This attempts to attach to the running transaction in order to account for
1464+
* delayed refs, but continues on even when no running transaction exists.
14651465
*
14661466
* Return: 0 if extent is not shared, 1 if it is shared, < 0 on error.
14671467
*/
@@ -1484,13 +1484,16 @@ int btrfs_check_shared(struct btrfs_root *root, u64 inum, u64 bytenr)
14841484
tmp = ulist_alloc(GFP_NOFS);
14851485
roots = ulist_alloc(GFP_NOFS);
14861486
if (!tmp || !roots) {
1487-
ulist_free(tmp);
1488-
ulist_free(roots);
1489-
return -ENOMEM;
1487+
ret = -ENOMEM;
1488+
goto out;
14901489
}
14911490

1492-
trans = btrfs_join_transaction(root);
1491+
trans = btrfs_attach_transaction(root);
14931492
if (IS_ERR(trans)) {
1493+
if (PTR_ERR(trans) != -ENOENT && PTR_ERR(trans) != -EROFS) {
1494+
ret = PTR_ERR(trans);
1495+
goto out;
1496+
}
14941497
trans = NULL;
14951498
down_read(&fs_info->commit_root_sem);
14961499
} else {
@@ -1523,6 +1526,7 @@ int btrfs_check_shared(struct btrfs_root *root, u64 inum, u64 bytenr)
15231526
} else {
15241527
up_read(&fs_info->commit_root_sem);
15251528
}
1529+
out:
15261530
ulist_free(tmp);
15271531
ulist_free(roots);
15281532
return ret;
@@ -1747,7 +1751,7 @@ int extent_from_logical(struct btrfs_fs_info *fs_info, u64 logical,
17471751
else if (flags & BTRFS_EXTENT_FLAG_DATA)
17481752
*flags_ret = BTRFS_EXTENT_FLAG_DATA;
17491753
else
1750-
BUG_ON(1);
1754+
BUG();
17511755
return 0;
17521756
}
17531757

@@ -1912,13 +1916,19 @@ int iterate_extent_inodes(struct btrfs_fs_info *fs_info,
19121916
extent_item_objectid);
19131917

19141918
if (!search_commit_root) {
1915-
trans = btrfs_join_transaction(fs_info->extent_root);
1916-
if (IS_ERR(trans))
1917-
return PTR_ERR(trans);
1919+
trans = btrfs_attach_transaction(fs_info->extent_root);
1920+
if (IS_ERR(trans)) {
1921+
if (PTR_ERR(trans) != -ENOENT &&
1922+
PTR_ERR(trans) != -EROFS)
1923+
return PTR_ERR(trans);
1924+
trans = NULL;
1925+
}
1926+
}
1927+
1928+
if (trans)
19181929
btrfs_get_tree_mod_seq(fs_info, &tree_mod_seq_elem);
1919-
} else {
1930+
else
19201931
down_read(&fs_info->commit_root_sem);
1921-
}
19221932

19231933
ret = btrfs_find_all_leafs(trans, fs_info, extent_item_objectid,
19241934
tree_mod_seq_elem.seq, &refs,
@@ -1951,7 +1961,7 @@ int iterate_extent_inodes(struct btrfs_fs_info *fs_info,
19511961

19521962
free_leaf_list(refs);
19531963
out:
1954-
if (!search_commit_root) {
1964+
if (trans) {
19551965
btrfs_put_tree_mod_seq(fs_info, &tree_mod_seq_elem);
19561966
btrfs_end_transaction(trans);
19571967
} else {

‎fs/btrfs/btrfs_inode.h‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,6 @@ struct btrfs_inode {
147147
*/
148148
u64 last_unlink_trans;
149149

150-
/*
151-
* Track the transaction id of the last transaction used to create a
152-
* hard link for the inode. This is used by the log tree (fsync).
153-
*/
154-
u64 last_link_trans;
155-
156150
/*
157151
* Number of bytes outstanding that are going to need csums. This is
158152
* used in ENOSPC accounting.
@@ -203,8 +197,6 @@ struct btrfs_inode {
203197
struct inode vfs_inode;
204198
};
205199

206-
extern unsigned char btrfs_filetype_table[];
207-
208200
static inline struct btrfs_inode *BTRFS_I(const struct inode *inode)
209201
{
210202
return container_of(inode, struct btrfs_inode, vfs_inode);

‎fs/btrfs/compression.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ static void end_compressed_bio_write(struct bio *bio)
251251
cb->compressed_pages[0]->mapping = cb->inode->i_mapping;
252252
btrfs_writepage_endio_finish_ordered(cb->compressed_pages[0],
253253
cb->start, cb->start + cb->len - 1,
254-
bio->bi_status ? BLK_STS_OK : BLK_STS_NOTSUPP);
254+
bio->bi_status == BLK_STS_OK);
255255
cb->compressed_pages[0]->mapping = NULL;
256256

257257
end_compressed_writeback(inode, cb);

0 commit comments

Comments
 (0)