All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs-progs: enforce block count on all devices in mkfs
@ 2012-03-28 18:20 Josef Bacik
  2012-03-29 15:10 ` David Sterba
  0 siblings, 1 reply; 2+ messages in thread
From: Josef Bacik @ 2012-03-28 18:20 UTC (permalink / raw)
  To: linux-btrfs

I had a test that creates a 7gig raid1 device but it was ending up wonky
because the second device that gets added is the full size of the disk
instead of the limited size.  So enforce the limited size on all disks
passed in at mkfs time, otherwise our threshold calculations end up wonky
when doing chunk allocations.  Thanks,

Signed-off-by: Josef Bacik <josef@redhat.com>
---
 mkfs.c  |    1 +
 utils.c |    2 ++
 2 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/mkfs.c b/mkfs.c
index c531ef2..6ae412f 100644
--- a/mkfs.c
+++ b/mkfs.c
@@ -1404,6 +1404,7 @@ int main(int ac, char **av)
 			close(fd);
 			continue;
 		}
+		dev_block_count = block_count;
 		ret = btrfs_prepare_device(fd, file, zero_end,
 					   &dev_block_count, &mixed);
 		mixed = old_mixed;
diff --git a/utils.c b/utils.c
index ee7fa1b..552233b 100644
--- a/utils.c
+++ b/utils.c
@@ -555,6 +555,8 @@ int btrfs_prepare_device(int fd, char *file, int zero_end, u64 *block_count_ret,
 		fprintf(stderr, "unable to find %s size\n", file);
 		exit(1);
 	}
+	if (*block_count_ret)
+		block_count = min(block_count, *block_count_ret);
 	zero_end = 1;
 
 	if (block_count < 1024 * 1024 * 1024 && !(*mixed)) {
-- 
1.7.5.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] btrfs-progs: enforce block count on all devices in mkfs
  2012-03-28 18:20 [PATCH] btrfs-progs: enforce block count on all devices in mkfs Josef Bacik
@ 2012-03-29 15:10 ` David Sterba
  0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2012-03-29 15:10 UTC (permalink / raw)
  To: Josef Bacik; +Cc: linux-btrfs

Hi,

looks similar to what's been sent

http://thread.gmane.org/gmane.comp.file-systems.btrfs/15472/focus=16227

david

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-03-29 15:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-28 18:20 [PATCH] btrfs-progs: enforce block count on all devices in mkfs Josef Bacik
2012-03-29 15:10 ` David Sterba

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.