Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 41a75a6e authored by Chris Mason's avatar Chris Mason
Browse files

Merge branch 'for-chris-4.11-rc5' of...

Merge branch 'for-chris-4.11-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux into for-linus-4.11
parents e1699d2d 457ae726
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1258,7 +1258,7 @@ struct btrfs_root {
	atomic_t will_be_snapshoted;

	/* 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)
{
+1 −1
Original line number Diff line number Diff line
@@ -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->refs, 1);
	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_committed = -1;
	root->last_log_commit = 0;
+28 −18
Original line number Diff line number Diff line
@@ -2584,27 +2584,37 @@ static void end_bio_extent_readpage(struct bio *bio)

		if (tree->ops) {
			ret = tree->ops->readpage_io_failed_hook(page, mirror);
			if (!ret && !bio->bi_error)
				uptodate = 1;
		} else {
			if (ret == -EAGAIN) {
				/*
			 * The generic bio_readpage_error handles errors the
			 * following way: If possible, new read requests are
			 * created and submitted and will end up in
			 * end_bio_extent_readpage as well (if we're lucky, not
			 * in the !uptodate case). In that case it returns 0 and
			 * we just go on with the next page in our bio. If it
			 * can't handle the error it will return -EIO and we
			 * remain responsible for that page.
			 */
			ret = bio_readpage_error(bio, offset, page, start, end,
						 mirror);
				 * Data inode's readpage_io_failed_hook() always
				 * returns -EAGAIN.
				 *
				 * The generic bio_readpage_error handles errors
				 * the following way: If possible, new read
				 * requests are created and submitted and will
				 * end up in end_bio_extent_readpage as well (if
				 * we're lucky, not in the !uptodate case). In
				 * that case it returns 0 and we just go on with
				 * the next page in our bio. If it can't handle
				 * 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) {
					uptodate = !bio->bi_error;
					offset += len;
					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:
		if (likely(uptodate)) {
			loff_t i_size = i_size_read(inode);
+3 −3
Original line number Diff line number Diff line
@@ -10523,9 +10523,9 @@ static int btrfs_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode)
}

__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 = {
@@ -10570,7 +10570,7 @@ static const struct extent_io_ops btrfs_extent_io_ops = {
	.submit_bio_hook = btrfs_submit_bio_hook,
	.readpage_end_io_hook = btrfs_readpage_end_io_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 */
	.fill_delalloc = run_delalloc_range,
+5 −5
Original line number Diff line number Diff line
@@ -2948,20 +2948,20 @@ int btrfs_qgroup_reserve_meta(struct btrfs_root *root, int num_bytes,
	ret = qgroup_reserve(root, num_bytes, enforce);
	if (ret < 0)
		return ret;
	atomic_add(num_bytes, &root->qgroup_meta_rsv);
	atomic64_add(num_bytes, &root->qgroup_meta_rsv);
	return ret;
}

void btrfs_qgroup_free_meta_all(struct btrfs_root *root)
{
	struct btrfs_fs_info *fs_info = root->fs_info;
	int reserved;
	u64 reserved;

	if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags) ||
	    !is_fstree(root->objectid))
		return;

	reserved = atomic_xchg(&root->qgroup_meta_rsv, 0);
	reserved = atomic64_xchg(&root->qgroup_meta_rsv, 0);
	if (reserved == 0)
		return;
	btrfs_qgroup_free_refroot(fs_info, root->objectid, reserved);
@@ -2976,8 +2976,8 @@ void btrfs_qgroup_free_meta(struct btrfs_root *root, int num_bytes)
		return;

	BUG_ON(num_bytes != round_down(num_bytes, fs_info->nodesize));
	WARN_ON(atomic_read(&root->qgroup_meta_rsv) < num_bytes);
	atomic_sub(num_bytes, &root->qgroup_meta_rsv);
	WARN_ON(atomic64_read(&root->qgroup_meta_rsv) < num_bytes);
	atomic64_sub(num_bytes, &root->qgroup_meta_rsv);
	btrfs_qgroup_free_refroot(fs_info, root->objectid, num_bytes);
}

Loading