linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: Nikolay Borisov <nborisov@suse.com>
Subject: [PATCH 6/8] btrfs: Explicitly reserve space for devreplace item
Date: Tue, 14 May 2019 13:54:43 +0300	[thread overview]
Message-ID: <20190514105445.23051-7-nborisov@suse.com> (raw)
In-Reply-To: <20190514105445.23051-1-nborisov@suse.com>

Part of device replace involves writing an item to the device root
containing information about pending replace operations. Currently space
for this item is not being explicitly reserved so this works thanks to
presence of global reserve. While not fatal it's not good practice.
Let's be explicit about space requirement of device replace and reserve
space when starting the transaction.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 fs/btrfs/dev-replace.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
index 61ae43308192..fb2bbc2a53a9 100644
--- a/fs/btrfs/dev-replace.c
+++ b/fs/btrfs/dev-replace.c
@@ -477,8 +477,8 @@ static int btrfs_dev_replace_start(struct btrfs_fs_info *fs_info,
 
 	btrfs_wait_ordered_roots(fs_info, U64_MAX, 0, (u64)-1);
 
-	/* force writing the updated state information to disk */
-	trans = btrfs_start_transaction(root, 0);
+	/* Commit dev_replace state and reserve 1 item for it. */
+	trans = btrfs_start_transaction(root, 1);
 	if (IS_ERR(trans)) {
 		ret = PTR_ERR(trans);
 		down_write(&dev_replace->rwsem);
-- 
2.17.1


  parent reply	other threads:[~2019-05-14 10:55 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-14 10:54 [PATCH 0/8] Misc improvements to dev-replace code Nikolay Borisov
2019-05-14 10:54 ` [PATCH 1/8] btrfs: Don't opencode sync_blockdev in btrfs_init_dev_replace_tgtdev Nikolay Borisov
2019-05-14 10:59   ` Johannes Thumshirn
2019-05-14 10:54 ` [PATCH 2/8] btrfs: Reduce critical section " Nikolay Borisov
2019-05-14 11:05   ` Johannes Thumshirn
2019-05-14 10:54 ` [PATCH 3/8] btrfs: Remove impossible WARN_ON Nikolay Borisov
2019-05-14 11:09   ` Johannes Thumshirn
2019-05-14 10:54 ` [PATCH 4/8] btrfs: Ensure btrfs_init_dev_replace_tgtdev sees up to date values Nikolay Borisov
2019-05-14 10:54 ` [PATCH 5/8] btrfs: Streamline replace sem unlock in btrfs_dev_replace_start Nikolay Borisov
2019-05-14 12:50   ` Johannes Thumshirn
2019-05-14 10:54 ` Nikolay Borisov [this message]
2019-05-14 12:56   ` [PATCH 6/8] btrfs: Explicitly reserve space for devreplace item Johannes Thumshirn
2019-05-14 10:54 ` [PATCH 7/8] btrfs: Ensure replaced device doesn't have pending chunk allocation Nikolay Borisov
2019-05-15 16:52   ` David Sterba
2019-05-17  7:44     ` [PATCH v2] " Nikolay Borisov
2019-05-17 14:28       ` David Sterba
2019-05-14 10:54 ` [PATCH 8/8] btrfs: Remove redundant assignment of tgt_device->commit_total_bytes Nikolay Borisov
2019-05-14 12:59   ` Johannes Thumshirn
2019-05-28 16:47 ` [PATCH 0/8] Misc improvements to dev-replace code David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190514105445.23051-7-nborisov@suse.com \
    --to=nborisov@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).