[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191028235621.GC15221@magnolia>
Date: Mon, 28 Oct 2019 16:56:21 -0700
From: "Darrick J. Wong" <darrick.wong@...cle.com>
To: Matthew Bobrowski <mbobrowski@...browski.org>
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 Tue, Oct 29, 2019 at 07:36:41AM +1100, Matthew Bobrowski wrote:
> 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.
<nod> I didn't see anything else obviously wrong, FWIW.
--D
> --<M>--
Powered by blists - more mailing lists