lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 1 Dec 2021 20:15:59 -0800
From:   Eric Biggers <ebiggers@...nel.org>
To:     Chao Yu <chao@...nel.org>
Cc:     Jaegeuk Kim <jaegeuk@...nel.org>, linux-kernel@...r.kernel.org,
        linux-f2fs-devel@...ts.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH 5/6] f2fs: implement iomap operations

On Thu, Dec 02, 2021 at 11:10:41AM +0800, Chao Yu wrote:
> > +static int f2fs_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
> > +			    unsigned int flags, struct iomap *iomap,
> > +			    struct iomap *srcmap)
> > +{
> > +	struct f2fs_map_blocks map = {};
> > +	pgoff_t next_pgofs = 0;
> > +	int err;
> > +
> > +	map.m_lblk = bytes_to_blks(inode, offset);
> > +	map.m_len = bytes_to_blks(inode, offset + length - 1) - map.m_lblk + 1;
> > +	map.m_next_pgofs = &next_pgofs;
> > +	map.m_seg_type = f2fs_rw_hint_to_seg_type(inode->i_write_hint);
> > +	if (flags & IOMAP_WRITE)
> > +		map.m_may_create = true;
> > +
> > +	err = f2fs_map_blocks(inode, &map, flags & IOMAP_WRITE,
> > +			      F2FS_GET_BLOCK_DIO);
> > +	if (err)
> > +		return err;
> > +
> > +	iomap->offset = blks_to_bytes(inode, map.m_lblk);
> > +
> > +	if (map.m_flags & (F2FS_MAP_MAPPED | F2FS_MAP_UNWRITTEN)) {
> > +		iomap->length = blks_to_bytes(inode, map.m_len);
> > +		if (map.m_flags & F2FS_MAP_MAPPED) {
> > +			iomap->type = IOMAP_MAPPED;
> > +			iomap->flags |= IOMAP_F_MERGED;
> > +		} else {
> > +			iomap->type = IOMAP_UNWRITTEN;
> > +		}
> > +		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;
> 
> Why not relocating this check before f2fs_map_blocks()?
> 
> Thanks,
> 
> > +		iomap->bdev = inode->i_sb->s_bdev;

Are you talking about the check for !f2fs_is_multi_device()?  It could go in
either location, but I think it makes the most sense to have it right before the
line that uses 'inode->i_sb->s_bdev', since that is the place which makes the
assumption that the filesystem has only one block device.

- Eric

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ