Re: [PATCH 1/2] Btrfs: add more valid checks for superblock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 04, 2016 at 10:40:02AM -0700, Liu Bo wrote:
> > > +		printk(KERN_ERR "BTRFS: bytes_used is too small %llu\n",
> > > +		       btrfs_super_bytes_used(sb));
> > > +		ret = -EINVAL;
> > > +	}
> > > +	if (btrfs_super_stripesize(sb) != 4096) {
> > 
> > This is too strict. The stripesize is unused, but we not force it to be
> > 4k, a multiple of nodesize/sectorsize should be enough.
> 
> Hmm, in fact stripesize is used in find_free_extent(),
> 
> find_free_extent() {
> 	...
> 	search_start = ALIGN(offset, root->stripesize);
> 	...
> }
> 
> and in open_ctree(),
> 
> open_ctree() {
> 	...
> 	stripesize = btrfs_super_stripesize(disk_super);
> 	...
> 	tree_root->stripesize = stripesize;
> 	...
> }
> 
> btrfs_read_roots() {
> 	...
> 	btrfs_read_tree_root()  --> __setup_root(..., tree_root->stripesize, ...)
> }
> 
> Thus, this stripesize has to be sectorsize at least.

Yes, and must be power of two because of ALIGN for now.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux