Loading fs/btrfs/ctree.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -1258,7 +1258,7 @@ struct btrfs_root { atomic_t will_be_snapshoted; atomic_t will_be_snapshoted; /* For qgroup metadata space reserve */ /* For qgroup metadata space reserve */ atomic_t qgroup_meta_rsv; atomic64_t qgroup_meta_rsv; }; }; static inline u32 btrfs_inode_sectorsize(const struct inode *inode) static inline u32 btrfs_inode_sectorsize(const struct inode *inode) { { Loading fs/btrfs/disk-io.c +1 −1 Original line number Original line Diff line number Diff line Loading @@ -1342,7 +1342,7 @@ static void __setup_root(struct btrfs_root *root, struct btrfs_fs_info *fs_info, atomic_set(&root->orphan_inodes, 0); atomic_set(&root->orphan_inodes, 0); atomic_set(&root->refs, 1); atomic_set(&root->refs, 1); atomic_set(&root->will_be_snapshoted, 0); atomic_set(&root->will_be_snapshoted, 0); atomic_set(&root->qgroup_meta_rsv, 0); atomic64_set(&root->qgroup_meta_rsv, 0); root->log_transid = 0; root->log_transid = 0; root->log_transid_committed = -1; root->log_transid_committed = -1; root->last_log_commit = 0; root->last_log_commit = 0; Loading fs/btrfs/extent_io.c +28 −18 Original line number Original line Diff line number Diff line Loading @@ -2584,27 +2584,37 @@ static void end_bio_extent_readpage(struct bio *bio) if (tree->ops) { if (tree->ops) { ret = tree->ops->readpage_io_failed_hook(page, mirror); ret = tree->ops->readpage_io_failed_hook(page, mirror); if (!ret && !bio->bi_error) if (ret == -EAGAIN) { uptodate = 1; } else { /* /* * The generic bio_readpage_error handles errors the * Data inode's readpage_io_failed_hook() always * following way: If possible, new read requests are * returns -EAGAIN. * created and submitted and will end up in * * end_bio_extent_readpage as well (if we're lucky, not * The generic bio_readpage_error handles errors * in the !uptodate case). In that case it returns 0 and * the following way: If possible, new read * we just go on with the next page in our bio. If it * requests are created and submitted and will * can't handle the error it will return -EIO and we * end up in end_bio_extent_readpage as well (if * remain responsible for that page. * we're lucky, not in the !uptodate case). In */ * that case it returns 0 and we just go on with ret = bio_readpage_error(bio, offset, page, start, end, * the next page in our bio. If it can't handle mirror); * the error it will return -EIO and we remain * responsible for that page. */ ret = bio_readpage_error(bio, offset, page, start, end, mirror); if (ret == 0) { if (ret == 0) { uptodate = !bio->bi_error; uptodate = !bio->bi_error; offset += len; offset += len; continue; continue; } } } } /* * metadata's readpage_io_failed_hook() always returns * -EIO and fixes nothing. -EIO is also returned if * data inode error could not be fixed. */ ASSERT(ret == -EIO); } readpage_ok: readpage_ok: if (likely(uptodate)) { if (likely(uptodate)) { loff_t i_size = i_size_read(inode); loff_t i_size = i_size_read(inode); Loading fs/btrfs/inode.c +3 −3 Original line number Original line Diff line number Diff line Loading @@ -10523,9 +10523,9 @@ static int btrfs_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode) } } __attribute__((const)) __attribute__((const)) static int dummy_readpage_io_failed_hook(struct page *page, int failed_mirror) static int btrfs_readpage_io_failed_hook(struct page *page, int failed_mirror) { { return 0; return -EAGAIN; } } static const struct inode_operations btrfs_dir_inode_operations = { static const struct inode_operations btrfs_dir_inode_operations = { Loading Loading @@ -10570,7 +10570,7 @@ static const struct extent_io_ops btrfs_extent_io_ops = { .submit_bio_hook = btrfs_submit_bio_hook, .submit_bio_hook = btrfs_submit_bio_hook, .readpage_end_io_hook = btrfs_readpage_end_io_hook, .readpage_end_io_hook = btrfs_readpage_end_io_hook, .merge_bio_hook = btrfs_merge_bio_hook, .merge_bio_hook = btrfs_merge_bio_hook, .readpage_io_failed_hook = dummy_readpage_io_failed_hook, .readpage_io_failed_hook = btrfs_readpage_io_failed_hook, /* optional callbacks */ /* optional callbacks */ .fill_delalloc = run_delalloc_range, .fill_delalloc = run_delalloc_range, Loading fs/btrfs/qgroup.c +5 −5 Original line number Original line Diff line number Diff line Loading @@ -2948,20 +2948,20 @@ int btrfs_qgroup_reserve_meta(struct btrfs_root *root, int num_bytes, ret = qgroup_reserve(root, num_bytes, enforce); ret = qgroup_reserve(root, num_bytes, enforce); if (ret < 0) if (ret < 0) return ret; return ret; atomic_add(num_bytes, &root->qgroup_meta_rsv); atomic64_add(num_bytes, &root->qgroup_meta_rsv); return ret; return ret; } } void btrfs_qgroup_free_meta_all(struct btrfs_root *root) void btrfs_qgroup_free_meta_all(struct btrfs_root *root) { { struct btrfs_fs_info *fs_info = root->fs_info; struct btrfs_fs_info *fs_info = root->fs_info; int reserved; u64 reserved; if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags) || if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags) || !is_fstree(root->objectid)) !is_fstree(root->objectid)) return; return; reserved = atomic_xchg(&root->qgroup_meta_rsv, 0); reserved = atomic64_xchg(&root->qgroup_meta_rsv, 0); if (reserved == 0) if (reserved == 0) return; return; btrfs_qgroup_free_refroot(fs_info, root->objectid, reserved); btrfs_qgroup_free_refroot(fs_info, root->objectid, reserved); Loading @@ -2976,8 +2976,8 @@ void btrfs_qgroup_free_meta(struct btrfs_root *root, int num_bytes) return; return; BUG_ON(num_bytes != round_down(num_bytes, fs_info->nodesize)); BUG_ON(num_bytes != round_down(num_bytes, fs_info->nodesize)); WARN_ON(atomic_read(&root->qgroup_meta_rsv) < num_bytes); WARN_ON(atomic64_read(&root->qgroup_meta_rsv) < num_bytes); atomic_sub(num_bytes, &root->qgroup_meta_rsv); atomic64_sub(num_bytes, &root->qgroup_meta_rsv); btrfs_qgroup_free_refroot(fs_info, root->objectid, num_bytes); btrfs_qgroup_free_refroot(fs_info, root->objectid, num_bytes); } } Loading Loading
fs/btrfs/ctree.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -1258,7 +1258,7 @@ struct btrfs_root { atomic_t will_be_snapshoted; atomic_t will_be_snapshoted; /* For qgroup metadata space reserve */ /* For qgroup metadata space reserve */ atomic_t qgroup_meta_rsv; atomic64_t qgroup_meta_rsv; }; }; static inline u32 btrfs_inode_sectorsize(const struct inode *inode) static inline u32 btrfs_inode_sectorsize(const struct inode *inode) { { Loading
fs/btrfs/disk-io.c +1 −1 Original line number Original line Diff line number Diff line Loading @@ -1342,7 +1342,7 @@ static void __setup_root(struct btrfs_root *root, struct btrfs_fs_info *fs_info, atomic_set(&root->orphan_inodes, 0); atomic_set(&root->orphan_inodes, 0); atomic_set(&root->refs, 1); atomic_set(&root->refs, 1); atomic_set(&root->will_be_snapshoted, 0); atomic_set(&root->will_be_snapshoted, 0); atomic_set(&root->qgroup_meta_rsv, 0); atomic64_set(&root->qgroup_meta_rsv, 0); root->log_transid = 0; root->log_transid = 0; root->log_transid_committed = -1; root->log_transid_committed = -1; root->last_log_commit = 0; root->last_log_commit = 0; Loading
fs/btrfs/extent_io.c +28 −18 Original line number Original line Diff line number Diff line Loading @@ -2584,27 +2584,37 @@ static void end_bio_extent_readpage(struct bio *bio) if (tree->ops) { if (tree->ops) { ret = tree->ops->readpage_io_failed_hook(page, mirror); ret = tree->ops->readpage_io_failed_hook(page, mirror); if (!ret && !bio->bi_error) if (ret == -EAGAIN) { uptodate = 1; } else { /* /* * The generic bio_readpage_error handles errors the * Data inode's readpage_io_failed_hook() always * following way: If possible, new read requests are * returns -EAGAIN. * created and submitted and will end up in * * end_bio_extent_readpage as well (if we're lucky, not * The generic bio_readpage_error handles errors * in the !uptodate case). In that case it returns 0 and * the following way: If possible, new read * we just go on with the next page in our bio. If it * requests are created and submitted and will * can't handle the error it will return -EIO and we * end up in end_bio_extent_readpage as well (if * remain responsible for that page. * we're lucky, not in the !uptodate case). In */ * that case it returns 0 and we just go on with ret = bio_readpage_error(bio, offset, page, start, end, * the next page in our bio. If it can't handle mirror); * the error it will return -EIO and we remain * responsible for that page. */ ret = bio_readpage_error(bio, offset, page, start, end, mirror); if (ret == 0) { if (ret == 0) { uptodate = !bio->bi_error; uptodate = !bio->bi_error; offset += len; offset += len; continue; continue; } } } } /* * metadata's readpage_io_failed_hook() always returns * -EIO and fixes nothing. -EIO is also returned if * data inode error could not be fixed. */ ASSERT(ret == -EIO); } readpage_ok: readpage_ok: if (likely(uptodate)) { if (likely(uptodate)) { loff_t i_size = i_size_read(inode); loff_t i_size = i_size_read(inode); Loading
fs/btrfs/inode.c +3 −3 Original line number Original line Diff line number Diff line Loading @@ -10523,9 +10523,9 @@ static int btrfs_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode) } } __attribute__((const)) __attribute__((const)) static int dummy_readpage_io_failed_hook(struct page *page, int failed_mirror) static int btrfs_readpage_io_failed_hook(struct page *page, int failed_mirror) { { return 0; return -EAGAIN; } } static const struct inode_operations btrfs_dir_inode_operations = { static const struct inode_operations btrfs_dir_inode_operations = { Loading Loading @@ -10570,7 +10570,7 @@ static const struct extent_io_ops btrfs_extent_io_ops = { .submit_bio_hook = btrfs_submit_bio_hook, .submit_bio_hook = btrfs_submit_bio_hook, .readpage_end_io_hook = btrfs_readpage_end_io_hook, .readpage_end_io_hook = btrfs_readpage_end_io_hook, .merge_bio_hook = btrfs_merge_bio_hook, .merge_bio_hook = btrfs_merge_bio_hook, .readpage_io_failed_hook = dummy_readpage_io_failed_hook, .readpage_io_failed_hook = btrfs_readpage_io_failed_hook, /* optional callbacks */ /* optional callbacks */ .fill_delalloc = run_delalloc_range, .fill_delalloc = run_delalloc_range, Loading
fs/btrfs/qgroup.c +5 −5 Original line number Original line Diff line number Diff line Loading @@ -2948,20 +2948,20 @@ int btrfs_qgroup_reserve_meta(struct btrfs_root *root, int num_bytes, ret = qgroup_reserve(root, num_bytes, enforce); ret = qgroup_reserve(root, num_bytes, enforce); if (ret < 0) if (ret < 0) return ret; return ret; atomic_add(num_bytes, &root->qgroup_meta_rsv); atomic64_add(num_bytes, &root->qgroup_meta_rsv); return ret; return ret; } } void btrfs_qgroup_free_meta_all(struct btrfs_root *root) void btrfs_qgroup_free_meta_all(struct btrfs_root *root) { { struct btrfs_fs_info *fs_info = root->fs_info; struct btrfs_fs_info *fs_info = root->fs_info; int reserved; u64 reserved; if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags) || if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags) || !is_fstree(root->objectid)) !is_fstree(root->objectid)) return; return; reserved = atomic_xchg(&root->qgroup_meta_rsv, 0); reserved = atomic64_xchg(&root->qgroup_meta_rsv, 0); if (reserved == 0) if (reserved == 0) return; return; btrfs_qgroup_free_refroot(fs_info, root->objectid, reserved); btrfs_qgroup_free_refroot(fs_info, root->objectid, reserved); Loading @@ -2976,8 +2976,8 @@ void btrfs_qgroup_free_meta(struct btrfs_root *root, int num_bytes) return; return; BUG_ON(num_bytes != round_down(num_bytes, fs_info->nodesize)); BUG_ON(num_bytes != round_down(num_bytes, fs_info->nodesize)); WARN_ON(atomic_read(&root->qgroup_meta_rsv) < num_bytes); WARN_ON(atomic64_read(&root->qgroup_meta_rsv) < num_bytes); atomic_sub(num_bytes, &root->qgroup_meta_rsv); atomic64_sub(num_bytes, &root->qgroup_meta_rsv); btrfs_qgroup_free_refroot(fs_info, root->objectid, num_bytes); btrfs_qgroup_free_refroot(fs_info, root->objectid, num_bytes); } } Loading