Userspace utilities to manage btrfs filesystems
Go to file
Jan Kara 1ee733a9ca mkfs: Handle creation of filesystem larger than the first device
On Wed 08-02-12 22:05:26, Phillip Susi wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 02/08/2012 06:20 PM, Jan Kara wrote:
> >   Thanks for your reply. I admit I was not sure what exactly size argument
> > should be. So after looking into the code for a while I figured it should
> > be a total size of the filesystem - or differently it should be size of
> > virtual block address space in the filesystem. Thus when filesystem has
> > more devices (or admin wants to add more devices later), it can be larger
> > than the first device. But I'm not really a btrfs developper so I might be
> > wrong and of course feel free to fix the issue as you deem fit.
>
> The size of the fs is the total size of the individual disks.  When you
> limit the size, you limit the size of a disk, not the whole fs.  IIRC,
> mkfs initializes the fs on the first disk, which is why it was using that
> size as the size of the whole fs, and then adds the other disks after (
> which then add their size to the total fs size ).
  OK, I missed that btrfs_add_to_fsid() increases total size of the
filesystem. So now I agree with you. New patch is attached. Thanks for your
review.

> It might be nice if
> mkfs could take sizes for each disk, but it only seems to take one size
> for the initial disk.
  Yes, but I don't see a realistic usecase so I don't think it's really
worth the work.

								Honza
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR

>From e5f46872232520310c56327593c02ef6a7f5ea33 Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Fri, 10 Feb 2012 11:44:44 +0100
Subject: [PATCH] mkfs: Handle creation of filesystem larger than the first device

mkfs does not properly check requested size of the filesystem. Thus if the
requested size is larger than the first device, it happily creates larger
filesystem than a device it resides on which results in 'attemp to access
beyond end of device' messages from the kernel. So verify specified filesystem
size against the size of the first device.

CC: David Sterba <dsterba@suse.cz>
Signed-off-by: Jan Kara <jack@suse.cz>
2012-07-03 16:27:46 -04:00
man Btrfs-progs: added resolve commands to man page 2011-11-02 15:45:45 -04:00
.gitignore btrfs-progs: add a recovery utility to pull files from damanged filesystems 2011-10-27 12:49:54 -04:00
.hgignore Add .hgignore file to ignore verison.h 2008-07-23 11:36:13 -04:00
.hgtags Added tag v0.16 for changeset 2b26e4f8c71e 2008-08-04 15:46:36 -04:00
bcp Btrfs-progs: Correct path munging in bcp 2011-10-25 09:18:58 -04:00
bit-radix.c Make btrfs-progs compile with -fstrict-aliasing (included in -O2) again. 2007-09-14 10:31:06 -04:00
bit-radix.h
btrfs-corrupt-block.c btrfsck: add early code to handle corrupted block groups 2012-02-22 10:59:55 -05:00
btrfs-defrag.c new util: 'btrfs' 2010-03-11 13:45:47 -05:00
btrfs-image.c Mixed back reference (FORWARD ROLLING FORMAT CHANGE) 2009-06-08 13:30:36 -04:00
btrfs-list.c avoid several strncpy-induced buffer overruns 2012-06-05 19:56:20 +01:00
btrfs-map-logical.c btrfs-map-logical: segfaults when no output file is given 2011-10-25 09:18:58 -04:00
btrfs-select-super.c btrfsck: decode error properly 2011-10-25 09:18:59 -04:00
btrfs-show.c Deprecate btrfsctl, btrfs-show, btrfs-vol 2011-10-25 09:18:31 -04:00
btrfs-vol.c Deprecate btrfsctl, btrfs-show, btrfs-vol 2011-10-25 09:18:31 -04:00
btrfs-zero-log.c btrfs-progs: make sure btrfs-zero-log writes something 2011-11-21 10:27:17 -05:00
btrfs.c Btrfs-progs: allow multi-line command group synopsis 2012-02-08 18:55:51 +02:00
btrfsck.c Btrfs-progs: make btrfsck aware of free space inodes 2012-06-05 19:56:19 +01:00
btrfsctl.c avoid several strncpy-induced buffer overruns 2012-06-05 19:56:20 +01:00
btrfslabel.c Fix segmentation fault when opening invalid file system 2012-07-03 16:27:46 -04:00
btrfslabel.h Add the "btrfs filesystem label" command 2011-10-25 09:18:31 -04:00
btrfstune.c update btrfs-progs for seed device support 2008-11-18 10:40:06 -05:00
calc-size.c btrfs-progs: add a recovery utility to pull files from damanged filesystems 2011-10-27 12:49:54 -04:00
cmds-balance.c Btrfs-progs: allow multi-line command group synopsis 2012-02-08 18:55:51 +02:00
cmds-device.c avoid several strncpy-induced buffer overruns 2012-06-05 19:56:20 +01:00
cmds-filesystem.c Btrfs-progs: make btrfs filesystem show <uuid> actually work 2012-07-03 16:27:46 -04:00
cmds-inspect.c Btrfs-progs: allow multi-line command group synopsis 2012-02-08 18:55:51 +02:00
cmds-scrub.c Btrfs-progs: allow multi-line command group synopsis 2012-02-08 18:55:51 +02:00
cmds-subvolume.c mkfs: avoid heap-buffer-read-underrun for zero-length "size" arg 2012-06-05 19:56:20 +01:00
commands.h Btrfs-progs: allow multi-line command group synopsis 2012-02-08 18:55:51 +02:00
common.c Btrfs-progs: rearrange files in the repo 2012-02-03 21:00:17 +02:00
convert.c Fix btrfs-convert, btrfs-restore and btrfs-find-root build 2012-02-08 23:11:49 -05:00
COPYING fix COPYING 2007-06-12 15:41:08 -04:00
crc32c.c CRC32C big endian bugs... 2008-02-15 11:20:02 -05:00
crc32c.h Mixed back reference (FORWARD ROLLING FORMAT CHANGE) 2009-06-08 13:30:36 -04:00
ctree.c btrfsck: add early code to handle corrupted block groups 2012-02-22 10:59:55 -05:00
ctree.h btrfs-progs: cleanup: remove the redundant BTRFS_CSUM_TYPE_CRC32 macro definition in ctree.h 2012-06-05 13:35:58 +01:00
debug-tree.c Add open_ctree_fs_info for partial FS opens 2012-02-05 16:11:48 -05:00
dir-item.c Fix unused-but-set errors in gcc-4.6 2011-10-25 09:18:32 -04:00
dir-test.c Btrfs: add btrfs-debug-tree -b <block number> to print a single block 2010-04-06 09:30:17 -04:00
disk-io.c btrfsck: add --init-csum-tree to replace the csum root with an empty one 2012-02-09 10:38:05 -05:00
disk-io.h Add open_ctree_fs_info for partial FS opens 2012-02-05 16:11:48 -05:00
extent_io.c Allow extent_buffers to use more ram 2012-02-06 05:08:06 -05:00
extent_io.h Verify parent generation number on btree reads 2008-05-13 13:48:58 -04:00
extent-cache.c Fix unused-but-set errors in gcc-4.6 2011-10-25 09:18:32 -04:00
extent-cache.h Add semantic checks to btrfsck for files and directories 2009-01-07 14:57:12 -05:00
extent-tree.c btrfsck: add early code to handle corrupted block groups 2012-02-22 10:59:55 -05:00
file-item.c btrfs-progs: Improvement for making btrfs image from source directory. 2011-10-25 09:19:00 -04:00
find-root.c btrfs-progs: add a recovery utility to pull files from damanged filesystems 2011-10-27 12:49:54 -04:00
hash.h Switch btrfs_name_hash() to crc32c 2008-08-20 20:11:23 -04:00
hasher.c Unaligned access fixes 2008-02-15 11:19:58 -05:00
help.c Btrfs-progs: allow multi-line command group synopsis 2012-02-08 18:55:51 +02:00
inode-item.c btrfs-progs new dir index support 2008-07-24 12:13:32 -04:00
inode-map.c btrfs-progs: Fix printf format casting errors 2008-04-01 10:52:22 -04:00
INSTALL btrfs-progs-unstable: replace debug-tree to btrfs-debug-tree in INSTALL 2011-10-25 09:18:59 -04:00
ioctl-test.c Test the additional ioctl. 2011-10-25 09:18:58 -04:00
ioctl.h Btrfs-progs: add restriper headers 2012-02-03 21:02:29 +02:00
kerncompat.h multidevice support for check_mounted 2010-09-23 20:26:49 -04:00
list.h Dynamic chunk allocation 2008-03-24 15:03:58 -04:00
Makefile Makefile: use $(MAKE) instead of hardcoded 'make' 2012-06-05 19:56:19 +01:00
mkfs.c mkfs: Handle creation of filesystem larger than the first device 2012-07-03 16:27:46 -04:00
print-tree.c btrfsck: add code to rebuild extent records 2012-02-07 10:58:32 -05:00
print-tree.h Btrfs: add btrfs-debug-tree -b <block number> to print a single block 2010-04-06 09:30:17 -04:00
quick-test.c Btrfs: add btrfs-debug-tree -b <block number> to print a single block 2010-04-06 09:30:17 -04:00
radix-tree.c Make btrfs-progs compile with -fstrict-aliasing (included in -O2) again. 2007-09-14 10:31:06 -04:00
radix-tree.h i386 fixes from axboe 2007-06-12 11:39:09 -04:00
random-test.c Btrfs: add btrfs-debug-tree -b <block number> to print a single block 2010-04-06 09:30:17 -04:00
rbtree.c Stop using radix trees to record pending allocations 2007-10-15 16:25:04 -04:00
rbtree.h Stop using radix trees to record pending allocations 2007-10-15 16:25:04 -04:00
repair.c Btrfsck: add the ability to prune corrupt extent allocation tree blocks 2012-02-21 14:37:21 -05:00
repair.h Btrfsck: add the ability to prune corrupt extent allocation tree blocks 2012-02-21 14:37:21 -05:00
restore.c avoid several strncpy-induced buffer overruns 2012-06-05 19:56:20 +01:00
root-tree.c Btrfs: update converter for the new disk format 2008-12-17 16:10:07 -05:00
show-blocks Fix showblocks to display different colors for different metadata roots 2009-03-09 13:00:44 -04:00
transaction.h Update btrfs-progs to match kernel sources 2008-01-04 10:38:22 -05:00
utils.c avoid several strncpy-induced buffer overruns 2012-06-05 19:56:20 +01:00
utils.h Scan the devices listed in /proc/partitions 2011-10-25 09:19:00 -04:00
version.sh btrfs-progs v0.19 2009-06-11 12:56:15 -04:00
volumes.c btrfsck: add early code to handle corrupted block groups 2012-02-22 10:59:55 -05:00
volumes.h btrfsck: add early code to handle corrupted block groups 2012-02-22 10:59:55 -05:00