* Request for comments about support btrfs in lvresize
@ 2025-03-10 8:35 Glass Su
2025-03-10 16:24 ` David Teigland
0 siblings, 1 reply; 5+ messages in thread
From: Glass Su @ 2025-03-10 8:35 UTC (permalink / raw)
To: lvm-devel; +Cc: teigland, zkabelac, Heming Zhao
Hi
I am drafting patches for btrfs support in lvresize command. All things went smoothly until I realized
multi-devices btrfs handling is a little complicated.
For one device btrfs, fslastblock * fsblocksize/FSSIZE is the correct value like ext* and xfs
But for multi-devices btrfs, the two values are whole fs size. The used size of device can be
known by btrfs-progs or superblock read and parse.
Heming suggested that maybe in fs_get_info(), execute of a external script named
lvresize_btrfs_helper.sh which calls btrfs-progs to gather information is a feasible way.
We both admit it’s not a grace way so here seek advices from you. Thanks.
—
Su
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Request for comments about support btrfs in lvresize
2025-03-10 8:35 Request for comments about support btrfs in lvresize Glass Su
@ 2025-03-10 16:24 ` David Teigland
2025-03-11 1:47 ` Glass Su
0 siblings, 1 reply; 5+ messages in thread
From: David Teigland @ 2025-03-10 16:24 UTC (permalink / raw)
To: Glass Su; +Cc: lvm-devel, zkabelac, Heming Zhao
On Mon, Mar 10, 2025 at 04:35:54PM +0800, Glass Su wrote:
> Hi
> I am drafting patches for btrfs support in lvresize command. All things went smoothly until I realized
> multi-devices btrfs handling is a little complicated.
btrfs using multiple devices sounds like an alternative to putting btrfs
on lvm, so is this actually done?
> For one device btrfs, fslastblock * fsblocksize/FSSIZE is the correct value like ext* and xfs
> But for multi-devices btrfs, the two values are whole fs size. The used size of device can be
> known by btrfs-progs or superblock read and parse.
These values are used to calculate fs_last_byte, and that is used:
- by lvextend as a sanity check after the fs resize is done. So, it could
be made optional for lvextend.
- by lvreduce to check if the fs has already been sufficiently shrunk, so
the fs shrink command can be skipped. Perhaps for btrfs, always require
the fs shrink command to be run, and always make fs_last_byte large enough
to do that.
Dave
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Request for comments about support btrfs in lvresize
2025-03-10 16:24 ` David Teigland
@ 2025-03-11 1:47 ` Glass Su
2025-03-11 2:03 ` Heming Zhao
2025-03-11 15:30 ` David Teigland
0 siblings, 2 replies; 5+ messages in thread
From: Glass Su @ 2025-03-11 1:47 UTC (permalink / raw)
To: David Teigland; +Cc: lvm-devel, zkabelac, Heming Zhao
> On Mar 11, 2025, at 00:24, David Teigland <teigland@redhat.com> wrote:
>
> On Mon, Mar 10, 2025 at 04:35:54PM +0800, Glass Su wrote:
>> Hi
>> I am drafting patches for btrfs support in lvresize command. All things went smoothly until I realized
>> multi-devices btrfs handling is a little complicated.
>
> btrfs using multiple devices sounds like an alternative to putting btrfs
> on lvm, so is this actually done?
Yeah. Btrfs don’t care about the backing device is lv or not. It just treats devices as how ext* and xfs do.
For those people don’t trust btrfs raid stability especially raid56, the use case indeed exits.
>
>> For one device btrfs, fslastblock * fsblocksize/FSSIZE is the correct value like ext* and xfs
>> But for multi-devices btrfs, the two values are whole fs size. The used size of device can be
>> known by btrfs-progs or superblock read and parse.
>
> These values are used to calculate fs_last_byte, and that is used:
>
> - by lvextend as a sanity check after the fs resize is done. So, it could
> be made optional for lvextend.
>
> - by lvreduce to check if the fs has already been sufficiently shrunk, so
> the fs shrink command can be skipped. Perhaps for btrfs, always require
> the fs shrink command to be run, and always make fs_last_byte large enough
> to do that.
Right. I’ve considered the way making fs_last_byte zero/large enough as `btrfs filesystem resize ` can
handle the newsize rightly. For me, it’s more like a quirk. If it’s acceptable to you I can provide a patchset to implement
the logic, and a testcase, of course.
—
Su
>
> Dave
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Request for comments about support btrfs in lvresize
2025-03-11 1:47 ` Glass Su
@ 2025-03-11 2:03 ` Heming Zhao
2025-03-11 15:30 ` David Teigland
1 sibling, 0 replies; 5+ messages in thread
From: Heming Zhao @ 2025-03-11 2:03 UTC (permalink / raw)
To: Glass Su, David Teigland; +Cc: lvm-devel, zkabelac
On 3/11/25 09:47, Glass Su wrote:
>
>
>> On Mar 11, 2025, at 00:24, David Teigland <teigland@redhat.com> wrote:
>>
>> On Mon, Mar 10, 2025 at 04:35:54PM +0800, Glass Su wrote:
>>> Hi
>>> I am drafting patches for btrfs support in lvresize command. All things went smoothly until I realized
>>> multi-devices btrfs handling is a little complicated.
>>
>> btrfs using multiple devices sounds like an alternative to putting btrfs
>> on lvm, so is this actually done?
>
> Yeah. Btrfs don’t care about the backing device is lv or not. It just treats devices as how ext* and xfs do.
> For those people don’t trust btrfs raid stability especially raid56, the use case indeed exits.
I feel that few users use btrfs on lvm2 with multiple LVs. because I have
never received any issue related to btrfs on lvm2. And from what I remember,
there are not too many users using LVM2 RAID mode either. People tend to
prefer using mdadm to manage RAID disks (or using hardware raid card).
Anyway, it is possible to set up btrfs on LVM2 with multiple LVs, so we
should support this scenario.
- Heming
>>
>>> For one device btrfs, fslastblock * fsblocksize/FSSIZE is the correct value like ext* and xfs
>>> But for multi-devices btrfs, the two values are whole fs size. The used size of device can be
>>> known by btrfs-progs or superblock read and parse.
>>
>> These values are used to calculate fs_last_byte, and that is used:
>>
>> - by lvextend as a sanity check after the fs resize is done. So, it could
>> be made optional for lvextend.
>>
>> - by lvreduce to check if the fs has already been sufficiently shrunk, so
>> the fs shrink command can be skipped. Perhaps for btrfs, always require
>> the fs shrink command to be run, and always make fs_last_byte large enough
>> to do that.
>
> Right. I’ve considered the way making fs_last_byte zero/large enough as `btrfs filesystem resize ` can
> handle the newsize rightly. For me, it’s more like a quirk. If it’s acceptable to you I can provide a patchset to implement
> the logic, and a testcase, of course.
>
> —
> Su
>>
>> Dave
>>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Request for comments about support btrfs in lvresize
2025-03-11 1:47 ` Glass Su
2025-03-11 2:03 ` Heming Zhao
@ 2025-03-11 15:30 ` David Teigland
1 sibling, 0 replies; 5+ messages in thread
From: David Teigland @ 2025-03-11 15:30 UTC (permalink / raw)
To: Glass Su; +Cc: lvm-devel, zkabelac, Heming Zhao
On Tue, Mar 11, 2025 at 09:47:21AM +0800, Glass Su wrote:
> Right. I’ve considered the way making fs_last_byte zero/large enough as `btrfs filesystem resize ` can
> handle the newsize rightly. For me, it’s more like a quirk. If it’s acceptable to you I can provide a patchset to implement
> the logic, and a testcase, of course.
Sure, I can review that.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-03-11 15:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-10 8:35 Request for comments about support btrfs in lvresize Glass Su
2025-03-10 16:24 ` David Teigland
2025-03-11 1:47 ` Glass Su
2025-03-11 2:03 ` Heming Zhao
2025-03-11 15:30 ` David Teigland
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.