xfs
[Top] [All Lists]

Re: [PATCH 1/2] dax: pass bdev argument to dax_clear_blocks()

To: Ross Zwisler <ross.zwisler@xxxxxxxxxxxxxxx>
Subject: Re: [PATCH 1/2] dax: pass bdev argument to dax_clear_blocks()
From: Dan Williams <dan.j.williams@xxxxxxxxx>
Date: Sun, 7 Feb 2016 10:19:29 -0800
Cc: "linux-kernel@xxxxxxxxxxxxxxx" <linux-kernel@xxxxxxxxxxxxxxx>, "Theodore Ts'o" <tytso@xxxxxxx>, Alexander Viro <viro@xxxxxxxxxxxxxxxxxx>, Andreas Dilger <adilger.kernel@xxxxxxxxx>, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, Dave Chinner <david@xxxxxxxxxxxxx>, Jan Kara <jack@xxxxxxxx>, Matthew Wilcox <willy@xxxxxxxxxxxxxxx>, linux-ext4 <linux-ext4@xxxxxxxxxxxxxxx>, linux-fsdevel <linux-fsdevel@xxxxxxxxxxxxxxx>, Linux MM <linux-mm@xxxxxxxxx>, "linux-nvdimm@xxxxxxxxxxxx" <linux-nvdimm@xxxxxxxxxxxx>, XFS Developers <xfs@xxxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=l90sa513N7j8emNvplZ7DDZ3GVGEAyl8jywwC5YIWew=; b=rGMd4YpgcBsltfNhKCWTxDdOLJGjaKPoB/KyXJylnb2ZkIiL25O/bZtkKs4k2h8FfY uI6PnRFc38CPjbNLd3M+ttl5e3Dl3gzcprbZov0NZ8D36r1JtxF4RFjJjqZ5UHvzPotO OvHjo3HwcZV/RUTA9pKRrbi+P3eEiT4ht8Lc9vMJ7ucZCZ+5Xs3Vb+FGp1/BrRTOjyCK xw19xlMIB3IQGwkDT5oHtFQ29ehiq/bsxzFEUFo3Kdm6V4DgEXoUDQS74JbRdOI8ccY0 sHvxEzXL2v5nocGZ1H+TjUiZoTVvOkpJyex/WEORVwz1gAyqs60K3KmSeXj9uktY7amV iSMg==
In-reply-to: <1454829553-29499-2-git-send-email-ross.zwisler@xxxxxxxxxxxxxxx>
References: <1454829553-29499-1-git-send-email-ross.zwisler@xxxxxxxxxxxxxxx> <1454829553-29499-2-git-send-email-ross.zwisler@xxxxxxxxxxxxxxx>
On Sat, Feb 6, 2016 at 11:19 PM, Ross Zwisler
<ross.zwisler@xxxxxxxxxxxxxxx> wrote:
> dax_clear_blocks() needs a valid struct block_device and previously it was
> using inode->i_sb->s_bdev in all cases.  This is correct for normal inodes
> on mounted ext2, ext4 and XFS filesystems, but is incorrect for DAX raw
> block devices and for XFS real-time devices.
>
> Instead, have the caller pass in a struct block_device pointer which it
> knows to be correct.
>
> Signed-off-by: Ross Zwisler <ross.zwisler@xxxxxxxxxxxxxxx>
> ---
>  fs/dax.c               | 4 ++--
>  fs/ext2/inode.c        | 5 +++--
>  fs/xfs/xfs_aops.c      | 2 +-
>  fs/xfs/xfs_aops.h      | 1 +
>  fs/xfs/xfs_bmap_util.c | 4 +++-
>  include/linux/dax.h    | 3 ++-
>  6 files changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/fs/dax.c b/fs/dax.c
> index 227974a..4592241 100644
> --- a/fs/dax.c
> +++ b/fs/dax.c
> @@ -83,9 +83,9 @@ struct page *read_dax_sector(struct block_device *bdev, 
> sector_t n)
>   * and hence this means the stack from this point must follow GFP_NOFS
>   * semantics for all operations.
>   */
> -int dax_clear_blocks(struct inode *inode, sector_t block, long _size)
> +int dax_clear_blocks(struct inode *inode, struct block_device *bdev,
> +               sector_t block, long _size)

Since this is a bdev relative routine we should also resolve the
sector, i.e. the signature should drop the inode:

int dax_clear_sectors(struct block_device *bdev, sector_t sector, long _size)

<Prev in Thread] Current Thread [Next in Thread>