linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Btrfs: Force stripesize to the value of sectorsize
@ 2016-06-23  9:46 Chandan Rajendra
  2016-06-23 10:13 ` David Sterba
  0 siblings, 1 reply; 2+ messages in thread
From: Chandan Rajendra @ 2016-06-23  9:46 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Chandan Rajendra, dsterba, bo.li.liu

Btrfs code currently assumes stripesize to be same as
sectorsize. However Btrfs-progs (until commit
df05c7ed455f519e6e15e46196392e4757257305) has been setting
btrfs_super_block->stripesize to a value of 4096.

This commit makes sure that the value of btrfs_super_block->stripesize
is a power of 2. Later, it unconditionally sets btrfs_root->stripesize
to sectorsize.

Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
---
 fs/btrfs/disk-io.c | 6 ++----
 fs/btrfs/volumes.c | 4 ++--
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 54cca7a..60ce119 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2806,7 +2806,7 @@ int open_ctree(struct super_block *sb,
 
 	nodesize = btrfs_super_nodesize(disk_super);
 	sectorsize = btrfs_super_sectorsize(disk_super);
-	stripesize = btrfs_super_stripesize(disk_super);
+	stripesize = sectorsize;
 	fs_info->dirty_metadata_batch = nodesize * (1 + ilog2(nr_cpu_ids));
 	fs_info->delalloc_batch = sectorsize * 512 * (1 + ilog2(nr_cpu_ids));
 
@@ -4133,9 +4133,7 @@ static int btrfs_check_super_valid(struct btrfs_fs_info *fs_info,
 		       btrfs_super_bytes_used(sb));
 		ret = -EINVAL;
 	}
-	if (!is_power_of_2(btrfs_super_stripesize(sb)) ||
-		((btrfs_super_stripesize(sb) != sectorsize) &&
-			(btrfs_super_stripesize(sb) != 4096))) {
+	if (!is_power_of_2(btrfs_super_stripesize(sb))) {
 		btrfs_err(fs_info, "invalid stripesize %u",
 		       btrfs_super_stripesize(sb));
 		ret = -EINVAL;
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index c3a2900..64eec2c 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -4694,12 +4694,12 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
 
 	if (type & BTRFS_BLOCK_GROUP_RAID5) {
 		raid_stripe_len = find_raid56_stripe_len(ndevs - 1,
-				 btrfs_super_stripesize(info->super_copy));
+						extent_root->stripesize);
 		data_stripes = num_stripes - 1;
 	}
 	if (type & BTRFS_BLOCK_GROUP_RAID6) {
 		raid_stripe_len = find_raid56_stripe_len(ndevs - 2,
-				 btrfs_super_stripesize(info->super_copy));
+						extent_root->stripesize);
 		data_stripes = num_stripes - 2;
 	}
 
-- 
2.5.5


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

* Re: [PATCH] Btrfs: Force stripesize to the value of sectorsize
  2016-06-23  9:46 [PATCH] Btrfs: Force stripesize to the value of sectorsize Chandan Rajendra
@ 2016-06-23 10:13 ` David Sterba
  0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2016-06-23 10:13 UTC (permalink / raw)
  To: Chandan Rajendra; +Cc: linux-btrfs, dsterba, bo.li.liu

On Thu, Jun 23, 2016 at 03:16:44PM +0530, Chandan Rajendra wrote:
> Btrfs code currently assumes stripesize to be same as
> sectorsize. However Btrfs-progs (until commit
> df05c7ed455f519e6e15e46196392e4757257305) has been setting
> btrfs_super_block->stripesize to a value of 4096.
> 
> This commit makes sure that the value of btrfs_super_block->stripesize
> is a power of 2. Later, it unconditionally sets btrfs_root->stripesize
> to sectorsize.
> 
> Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>

Reviewed-by: David Sterba <dsterba@suse.com>

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

end of thread, other threads:[~2016-06-23 10:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-23  9:46 [PATCH] Btrfs: Force stripesize to the value of sectorsize Chandan Rajendra
2016-06-23 10:13 ` 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).