Re: [f2fs-dev] [PATCH 5/6] f2fs: implement iomap operations

From: Eric Biggers
Date: Thu Dec 02 2021 - 15:58:13 EST


On Thu, Dec 02, 2021 at 11:00:47AM -0800, Jaegeuk Kim wrote:
> On 12/02, Jaegeuk Kim wrote:
> > On 12/02, Eric Biggers wrote:
> > > On Thu, Dec 02, 2021 at 10:04:11PM +0800, Chao Yu wrote:
> > > > On 2021/12/2 12:15, Eric Biggers wrote:
> > > > > On Thu, Dec 02, 2021 at 11:10:41AM +0800, Chao Yu wrote:
> > > > > > Why not relocating this check before f2fs_map_blocks()?
> > > >
> > > > Wait, it supports DIO in multi-device image after commit 71f2c8206202
> > > > ("f2fs: multidevice: support direct IO"), how about
> > > > checking with f2fs_allow_multi_device_dio()?
> > > >
> > > > Thanks,
> > > >
> > >
> > > Okay, that was not the case when I sent this patch originally. We'll need to
> > > update this to support multiple devices.
> >
> > Chao/Eric, does this make sense?
> >
> > --- a/fs/f2fs/data.c
> > +++ b/fs/f2fs/data.c
> > @@ -4070,11 +4070,10 @@ static int f2fs_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
> > }
> > if (WARN_ON_ONCE(!__is_valid_data_blkaddr(map.m_pblk)))
> > return -EINVAL;
> > - iomap->addr = blks_to_bytes(inode, map.m_pblk);
> >
> > - if (WARN_ON_ONCE(f2fs_is_multi_device(F2FS_I_SB(inode))))
> > - return -EINVAL;
> > - iomap->bdev = inode->i_sb->s_bdev;
> > + iomap->bdev = map->m_multidev_dio ? map.m_bdev :
>
> correction: map.m_multidev_dio
>

I guess so, but why doesn't f2fs_map_blocks() just always set m_bdev to the
correct block device? What is the point of m_multidev_dio?

- Eric