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]
Message-ID: <20191028203641.GA25021@bobrowski>
Date:   Tue, 29 Oct 2019 07:36:41 +1100
From:   Matthew Bobrowski <mbobrowski@...browski.org>
To:     "Darrick J. Wong" <darrick.wong@...cle.com>
Cc:     tytso@....edu, jack@...e.cz, adilger.kernel@...ger.ca,
        linux-ext4@...r.kernel.org, linux-fsdevel@...r.kernel.org,
        hch@...radead.org, david@...morbit.com
Subject: Re: [PATCH v6 04/11] ext4: move set iomap routines into a separate
 helper ext4_set_iomap()

On Mon, Oct 28, 2019 at 10:03:48AM -0700, Darrick J. Wong wrote:
> On Mon, Oct 28, 2019 at 09:51:31PM +1100, Matthew Bobrowski wrote:
> > +static void ext4_set_iomap(struct inode *inode, struct iomap *iomap,
> > +			   struct ext4_map_blocks *map, loff_t offset,
> > +			   loff_t length)
> > +{
> > +	u8 blkbits = inode->i_blkbits;
> > +
> > +	/*
> > +	 * Writes that span EOF might trigger an I/O size update on completion,
> > +	 * so consider them to be dirty for the purpose of O_DSYNC, even if
> > +	 * there is no other metadata changes being made or are pending.
> > +	 */
> > +	iomap->flags = 0;
> > +	if (ext4_inode_datasync_dirty(inode) ||
> > +	    offset + length > i_size_read(inode))
> > +		iomap->flags |= IOMAP_F_DIRTY;
> > +
> > +	if (map->m_flags & EXT4_MAP_NEW)
> > +		iomap->flags |= IOMAP_F_NEW;
> > +
> > +	iomap->bdev = inode->i_sb->s_bdev;
> > +	iomap->dax_dev = EXT4_SB(inode->i_sb)->s_daxdev;
> > +	iomap->offset = (u64) map->m_lblk << blkbits;
> > +	iomap->length = (u64) map->m_len << blkbits;
> > +
> > +	if (map->m_flags & (EXT4_MAP_MAPPED | EXT4_MAP_UNWRITTEN)) {
> 
> /me wonders if this would be easier to follow if it was less indenty:
> 
> /*
>  * <giant comment from below>
>  */
> if (m_flags & EXT4_MAP_UNWRITTEN) {
> 	iomap->type = IOMAP_UNWRITTEN;
> 	iomap->addr = ...
> } else if (m_flags & EXT4_MAP_MAPPED) {
> 	iomap->type = IOAMP_MAPPED;
> 	iomap->addr = ...
> } else {
> 	iomap->type = IOMAP_HOLE;
> 	iomap->addr = IOMAP_NULL_ADDR;
> }
> 
> Rather than double-checking m_flags?

Yeah, you're right. The extra checks and levels of indentation aren't really
necessary and can be simplified further, as you've suggested above.

Thanks for looking over this for me.

/me adds this to the TODO for v7.

--<M>--

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ