On 04/13, Pankaj Raghav wrote:
> Hi Jaegeuk,
> 
> On 2022-04-13 19:03, Jaegeuk Kim wrote
> >> @@ -882,6 +882,11 @@ static int open_check_fs(char *path, int flag)
> >>    return open(path, O_RDONLY | flag);
> >>  }
> >>  
> >> +static int is_power_of_2(unsigned long n)
> > 
> > So, this needs to check 2MB alignment only?
> > 
> As I explained in the v1 thread, zoned support for f2fs assumes po2 zone
> sizes. For e.g.,
> static int __f2fs_issue_discard_zone(struct f2fs_sb_info *sbi,
>               struct block_device *bdev, block_t blkstart, block_t blklen)
> {
>       sector_t sector, nr_sects;
>       block_t lblkstart = blkstart;
>       int devi = 0;
> ...
> ...
>               // Assumes zone sectors to be po2

Well, I think this will be aligned to 2MB, if the device gives NPO2? IOWs, this
is just checking the granularity, not PO2.

>               if (sector & (bdev_zone_sectors(bdev) - 1) ||
>                               nr_sects != bdev_zone_sectors(bdev)) {
>                       f2fs_err(sbi, "(%d) %s: Unaligned zone reset attempted 
> (block %x + %x)",
>                                devi, sbi->s_ndevs ? FDEV(devi).path : "",
>                                blkstart, blklen);
>                       return -EIO;
>               }
> 
> ...
> }
> 
> So until non power of 2 zoned devices are supported in block layer and
> f2fs, it is safer to reject non power of 2 devices during mkfs time. I
> hope it clarifies.


_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to