mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 13:30:45 -05:00
Merge tag 'for-6.17-rc6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux
Pull btrfs fixes from David Sterba: - in zoned mode, turn assertion to proper code when reserving space in relocation block group - fix search key of extended ref (hardlink) when replaying log - fix initialization of file extent tree on filesystems without no-holes feature - add harmless data race annotation to block group comparator * tag 'for-6.17-rc6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux: btrfs: annotate block group access with data_race() when sorting for reclaim btrfs: initialize inode::file_extent_tree after i_mode has been set btrfs: zoned: fix incorrect ASSERT in btrfs_zoned_reserve_data_reloc_bg() btrfs: fix invalid extref key setup when replaying dentry
This commit is contained in:
@@ -1795,7 +1795,14 @@ static int reclaim_bgs_cmp(void *unused, const struct list_head *a,
|
||||
bg1 = list_entry(a, struct btrfs_block_group, bg_list);
|
||||
bg2 = list_entry(b, struct btrfs_block_group, bg_list);
|
||||
|
||||
return bg1->used > bg2->used;
|
||||
/*
|
||||
* Some other task may be updating the ->used field concurrently, but it
|
||||
* is not serious if we get a stale value or load/store tearing issues,
|
||||
* as sorting the list of block groups to reclaim is not critical and an
|
||||
* occasional imperfect order is ok. So silence KCSAN and avoid the
|
||||
* overhead of locking or any other synchronization.
|
||||
*/
|
||||
return data_race(bg1->used > bg2->used);
|
||||
}
|
||||
|
||||
static inline bool btrfs_should_reclaim(const struct btrfs_fs_info *fs_info)
|
||||
|
||||
@@ -1843,7 +1843,6 @@ static void fill_stack_inode_item(struct btrfs_trans_handle *trans,
|
||||
|
||||
int btrfs_fill_inode(struct btrfs_inode *inode, u32 *rdev)
|
||||
{
|
||||
struct btrfs_fs_info *fs_info = inode->root->fs_info;
|
||||
struct btrfs_delayed_node *delayed_node;
|
||||
struct btrfs_inode_item *inode_item;
|
||||
struct inode *vfs_inode = &inode->vfs_inode;
|
||||
@@ -1864,8 +1863,6 @@ int btrfs_fill_inode(struct btrfs_inode *inode, u32 *rdev)
|
||||
i_uid_write(vfs_inode, btrfs_stack_inode_uid(inode_item));
|
||||
i_gid_write(vfs_inode, btrfs_stack_inode_gid(inode_item));
|
||||
btrfs_i_size_write(inode, btrfs_stack_inode_size(inode_item));
|
||||
btrfs_inode_set_file_extent_range(inode, 0,
|
||||
round_up(i_size_read(vfs_inode), fs_info->sectorsize));
|
||||
vfs_inode->i_mode = btrfs_stack_inode_mode(inode_item);
|
||||
set_nlink(vfs_inode, btrfs_stack_inode_nlink(inode_item));
|
||||
inode_set_bytes(vfs_inode, btrfs_stack_inode_nbytes(inode_item));
|
||||
|
||||
@@ -3885,10 +3885,6 @@ static int btrfs_read_locked_inode(struct btrfs_inode *inode, struct btrfs_path
|
||||
bool filled = false;
|
||||
int first_xattr_slot;
|
||||
|
||||
ret = btrfs_init_file_extent_tree(inode);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
ret = btrfs_fill_inode(inode, &rdev);
|
||||
if (!ret)
|
||||
filled = true;
|
||||
@@ -3920,8 +3916,6 @@ static int btrfs_read_locked_inode(struct btrfs_inode *inode, struct btrfs_path
|
||||
i_uid_write(vfs_inode, btrfs_inode_uid(leaf, inode_item));
|
||||
i_gid_write(vfs_inode, btrfs_inode_gid(leaf, inode_item));
|
||||
btrfs_i_size_write(inode, btrfs_inode_size(leaf, inode_item));
|
||||
btrfs_inode_set_file_extent_range(inode, 0,
|
||||
round_up(i_size_read(vfs_inode), fs_info->sectorsize));
|
||||
|
||||
inode_set_atime(vfs_inode, btrfs_timespec_sec(leaf, &inode_item->atime),
|
||||
btrfs_timespec_nsec(leaf, &inode_item->atime));
|
||||
@@ -3953,6 +3947,11 @@ static int btrfs_read_locked_inode(struct btrfs_inode *inode, struct btrfs_path
|
||||
btrfs_set_inode_mapping_order(inode);
|
||||
|
||||
cache_index:
|
||||
ret = btrfs_init_file_extent_tree(inode);
|
||||
if (ret)
|
||||
goto out;
|
||||
btrfs_inode_set_file_extent_range(inode, 0,
|
||||
round_up(i_size_read(vfs_inode), fs_info->sectorsize));
|
||||
/*
|
||||
* If we were modified in the current generation and evicted from memory
|
||||
* and then re-read we need to do a full sync since we don't have any
|
||||
|
||||
@@ -1964,7 +1964,7 @@ static noinline int replay_one_name(struct btrfs_trans_handle *trans,
|
||||
|
||||
search_key.objectid = log_key.objectid;
|
||||
search_key.type = BTRFS_INODE_EXTREF_KEY;
|
||||
search_key.offset = key->objectid;
|
||||
search_key.offset = btrfs_extref_hash(key->objectid, name.name, name.len);
|
||||
ret = backref_in_log(root->log_root, &search_key, key->objectid, &name);
|
||||
if (ret < 0) {
|
||||
goto out;
|
||||
|
||||
@@ -2582,9 +2582,9 @@ void btrfs_zoned_reserve_data_reloc_bg(struct btrfs_fs_info *fs_info)
|
||||
spin_lock(&space_info->lock);
|
||||
space_info->total_bytes -= bg->length;
|
||||
space_info->disk_total -= bg->length * factor;
|
||||
space_info->disk_total -= bg->zone_unusable;
|
||||
/* There is no allocation ever happened. */
|
||||
ASSERT(bg->used == 0);
|
||||
ASSERT(bg->zone_unusable == 0);
|
||||
/* No super block in a block group on the zoned setup. */
|
||||
ASSERT(bg->bytes_super == 0);
|
||||
spin_unlock(&space_info->lock);
|
||||
|
||||
Reference in New Issue
Block a user