]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
btrfs: store fs_info in space_info
authorBoris Burkov <boris@bur.io>
Fri, 2 Feb 2024 19:52:57 +0000 (11:52 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Feb 2026 15:43:55 +0000 (16:43 +0100)
[ Upstream commit 42f620aec182f62ee72e3fce41cb3353951b3508 ]

This is handy when computing space_info dynamic reclaim thresholds where
we do not have access to a block group. We could add it to the various
functions as a parameter, but it seems reasonable for space_info to have
an fs_info pointer.

Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Boris Burkov <boris@bur.io>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Stable-dep-of: a11224a016d6 ("btrfs: fix memory leaks in create_space_info() error paths")
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/btrfs/space-info.c
fs/btrfs/space-info.h

index bede72f3dffc3306e7a8d5f9efe60af0d017ffc0..069df2ebd1ca5d0abcdef4f7eff040498dee4bfe 100644 (file)
@@ -230,6 +230,7 @@ static int create_space_info(struct btrfs_fs_info *info, u64 flags)
        if (!space_info)
                return -ENOMEM;
 
+       space_info->fs_info = info;
        for (i = 0; i < BTRFS_NR_RAID_TYPES; i++)
                INIT_LIST_HEAD(&space_info->block_groups[i]);
        init_rwsem(&space_info->groups_sem);
index fea2f93674e7cd53f6d6a1cdcc40a4d9743272a9..d6b34f2738b53a1e5fd2b138dbfa4c360fe2ea99 100644 (file)
@@ -65,6 +65,7 @@ enum btrfs_flush_state {
 };
 
 struct btrfs_space_info {
+       struct btrfs_fs_info *fs_info;
        spinlock_t lock;
 
        u64 total_bytes;        /* total bytes in the space,