From: Austin S Hemmelgarn <ahferroin7@gmail.com>
To: "Piotr Pawłow" <pp@siedziba.pl>,
"Paul Jones" <paul@pauljones.id.au>,
"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: Re: Cancel device remove?
Date: Thu, 10 Sep 2015 09:47:19 -0400 [thread overview]
Message-ID: <55F189E7.8020509@gmail.com> (raw)
In-Reply-To: <55F18310.9070907@siedziba.pl>
[-- Attachment #1: Type: text/plain, Size: 1609 bytes --]
On 2015-09-10 09:18, Piotr Pawłow wrote:
> Hello,
>> Is there some way to cancel a device remove operation? I have
>> discovered that if I reboot that will cancel it, but that's not always
>> possible. What I'm after is something the same as cancelling scrub.
>> I keep running into situations where I want to pause a remove
>> operation for speed reasons.
>
> Since removing a device involves shrinking it to 0 size first
> (http://lxr.free-electrons.com/source/fs/btrfs/volumes.c#L1743), I guess
> you could just run "btrfs filesystem resize" in a loop as a workaround,
> shrinking it incrementally, and then remove at the end.
OK, what I'm about to say may be absolutely totally wrong, you have been
warned. If I understand the code correctly, device remove is internally
equivalent to shrinking the device to 0 size, and then running a
balance, then deleting the device from the FS metadata. Based on this,
I 'think' than you may be able to use btrfs balance cancel on the FS to
stop the device remove, and then optionally do a resize to revert the
remove. However, even it this does work, it probably isn't a
particularly good idea. I would love to see some way in the tools to
pause/cancel this just like a scrub or balance however.
It is worth noting that you should be able to limit the disk
bandwidth/set the I/O priority of the operation by using either
cgroups/ionice respectively on the userspace command (unlike a replace
operation, a device removal is synchronous, and should inherit the I/O
scheduler parameters from the command that invoked it).
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 3019 bytes --]
prev parent reply other threads:[~2015-09-10 13:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-10 4:41 Cancel device remove? Paul Jones
2015-09-10 13:18 ` Piotr Pawłow
2015-09-10 13:47 ` Austin S Hemmelgarn [this message]
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=55F189E7.8020509@gmail.com \
--to=ahferroin7@gmail.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=paul@pauljones.id.au \
--cc=pp@siedziba.pl \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.