[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180310095558.GC31604@lst.de>
Date: Sat, 10 Mar 2018 10:55:58 +0100
From: Christoph Hellwig <hch@....de>
To: Dan Williams <dan.j.williams@...el.com>
Cc: linux-nvdimm@...ts.01.org, Jan Kara <jack@...e.cz>,
Dave Chinner <david@...morbit.com>,
"Darrick J. Wong" <darrick.wong@...cle.com>,
Ross Zwisler <ross.zwisler@...ux.intel.com>,
Christoph Hellwig <hch@....de>, linux-xfs@...r.kernel.org,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 11/11] xfs, dax: introduce xfs_break_dax_layouts()
> +static int xfs_wait_dax_page(
> + atomic_t *count,
> + unsigned int mode)
> +{
Normal XFS style would be:
static int
xfs_wait_dax_page(
atomic_t *count,
unsigned int mode)
{
> + struct page *page = refcount_to_page(count);
> + struct address_space *mapping = page->mapping;
> + struct inode *inode = mapping->host;
> + struct xfs_inode *ip = XFS_I(inode);
Looks we don't really need the mapping and inode variables:
struct page *page = refcount_to_page(count);
struct xfs_inode *ip = XFS_I(page->mapping->host);
> + do {
> + if (flags & XFS_BREAK_REMOTE)
> + ret = xfs_break_leased_layouts(inode, iolock);
> + if (ret)
> + return ret;
> + if (flags & XFS_BREAK_MAPS)
> + ret = xfs_break_dax_layouts(inode, *iolock);
> + /*
> + * EBUSY indicates that we dropped locks and waited for
> + * the dax layout to be released. When that happens we
> + * need to revalidate that no new leases or pinned dax
> + * mappings have been established.
> + */
> + } while (ret == -EBUSY);
Maybe instead of the flags argument this should be a type argument
of something like
enum layout_break_reason {
BREAK_WRITE, /* write to file */
BREAK_TRUNCATE, /* truncate or hole punch */
};
as that makes the intent more clear?
Powered by blists - more mailing lists