* [PATCH] Btrfs-progs: Prevent creation of filesystem with 'mixed bgs' and having differing sectorsize and nodesize.
@ 2015-10-14 17:40 Chandan Rajendra
2015-10-26 18:57 ` David Sterba
0 siblings, 1 reply; 2+ messages in thread
From: Chandan Rajendra @ 2015-10-14 17:40 UTC (permalink / raw)
To: linux-btrfs; +Cc: Chandan Rajendra, dsterba, chandan
mkfs.btrfs allows creation of Btrfs filesystem instances with mixed block
group feature enabled and having a sectorsize different from nodesize.
For e.g:
[root@localhost btrfs-progs]# mkfs.btrfs -f -M -s 4096 -n 16384 /dev/loop0
Forcing mixed metadata/data groups
btrfs-progs v3.19-rc2-404-gbbbd18e-dirty
See http://btrfs.wiki.kernel.org for more information.
Performing full device TRIM (4.00GiB) ...
Label: (null)
UUID: c82b5720-6d88-4fa1-ac05-d0d4cb797fd5
Node size: 16384
Sector size: 4096
Filesystem size: 4.00GiB
Block group profiles:
Data+Metadata: single 8.00MiB
System: single 4.00MiB
SSD detected: no
Incompat features: mixed-bg, extref, skinny-metadata
Number of devices: 1
Devices:
ID SIZE PATH
1 4.00GiB /dev/loop6
This commit fixes the issue by setting BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS
feature bit before checking the validity of nodesize that was specified on the
command line.
Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
---
mkfs.c | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/mkfs.c b/mkfs.c
index dc70a9a..10016b2 100644
--- a/mkfs.c
+++ b/mkfs.c
@@ -1541,6 +1541,19 @@ int main(int ac, char **av)
if (!nodesize_forced)
nodesize = best_nodesize;
}
+
+ /*
+ * FS features that can be set by other means than -O
+ * just set the bit here
+ */
+ if (mixed)
+ features |= BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS;
+
+ if ((data_profile | metadata_profile) &
+ (BTRFS_BLOCK_GROUP_RAID5 | BTRFS_BLOCK_GROUP_RAID6)) {
+ features |= BTRFS_FEATURE_INCOMPAT_RAID56;
+ }
+
if (btrfs_check_nodesize(nodesize, sectorsize,
features))
exit(1);
@@ -1648,18 +1661,6 @@ int main(int ac, char **av)
"WARNING: metatdata has lower redundancy than data!\n\n");
}
- /*
- * FS features that can be set by other means than -O
- * just set the bit here
- */
- if (mixed)
- features |= BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS;
-
- if ((data_profile | metadata_profile) &
- (BTRFS_BLOCK_GROUP_RAID5 | BTRFS_BLOCK_GROUP_RAID6)) {
- features |= BTRFS_FEATURE_INCOMPAT_RAID56;
- }
-
mkfs_cfg.label = label;
mkfs_cfg.fs_uuid = fs_uuid;
memcpy(mkfs_cfg.blocks, blocks, sizeof(blocks));
--
2.1.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Btrfs-progs: Prevent creation of filesystem with 'mixed bgs' and having differing sectorsize and nodesize.
2015-10-14 17:40 [PATCH] Btrfs-progs: Prevent creation of filesystem with 'mixed bgs' and having differing sectorsize and nodesize Chandan Rajendra
@ 2015-10-26 18:57 ` David Sterba
0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2015-10-26 18:57 UTC (permalink / raw)
To: Chandan Rajendra; +Cc: linux-btrfs, dsterba, chandan
On Wed, Oct 14, 2015 at 11:10:38PM +0530, Chandan Rajendra wrote:
> mkfs.btrfs allows creation of Btrfs filesystem instances with mixed block
> group feature enabled and having a sectorsize different from nodesize.
> For e.g:
>
> [root@localhost btrfs-progs]# mkfs.btrfs -f -M -s 4096 -n 16384 /dev/loop0
> Forcing mixed metadata/data groups
> btrfs-progs v3.19-rc2-404-gbbbd18e-dirty
> See http://btrfs.wiki.kernel.org for more information.
>
> Performing full device TRIM (4.00GiB) ...
> Label: (null)
> UUID: c82b5720-6d88-4fa1-ac05-d0d4cb797fd5
> Node size: 16384
> Sector size: 4096
> Filesystem size: 4.00GiB
> Block group profiles:
> Data+Metadata: single 8.00MiB
> System: single 4.00MiB
> SSD detected: no
> Incompat features: mixed-bg, extref, skinny-metadata
> Number of devices: 1
> Devices:
> ID SIZE PATH
> 1 4.00GiB /dev/loop6
>
> This commit fixes the issue by setting BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS
> feature bit before checking the validity of nodesize that was specified on the
> command line.
>
> Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Test added and applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-10-26 18:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-14 17:40 [PATCH] Btrfs-progs: Prevent creation of filesystem with 'mixed bgs' and having differing sectorsize and nodesize Chandan Rajendra
2015-10-26 18:57 ` David Sterba
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).