[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160510142119.GN11897@quack2.suse.cz>
Date: Tue, 10 May 2016 16:21:19 +0200
From: Jan Kara <jack@...e.cz>
To: Vishal Verma <vishal.l.verma@...el.com>
Cc: linux-nvdimm@...ts.01.org, linux-fsdevel@...r.kernel.org,
linux-block@...r.kernel.org, xfs@....sgi.com,
linux-ext4@...r.kernel.org, linux-mm@...ck.org,
Ross Zwisler <ross.zwisler@...ux.intel.com>,
Dan Williams <dan.j.williams@...el.com>,
Dave Chinner <david@...morbit.com>, Jan Kara <jack@...e.cz>,
Jens Axboe <axboe@...com>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org,
Christoph Hellwig <hch@...radead.org>,
Jeff Moyer <jmoyer@...hat.com>,
Boaz Harrosh <boaz@...xistor.com>
Subject: Re: [PATCH v5 4/5] dax: for truncate/hole-punch, do zeroing through
the driver if possible
On Fri 06-05-16 15:53:10, Vishal Verma wrote:
> +static bool dax_range_is_aligned(struct block_device *bdev,
> + struct blk_dax_ctl *dax, unsigned int offset,
> + unsigned int length)
> +{
> + unsigned short sector_size = bdev_logical_block_size(bdev);
> +
> + if (((u64)dax->addr + offset) % sector_size)
> + return false;
> + if (length % sector_size)
> + return false;
sector_size should better be a power of two so you can save some cycles by
using & instead of %.
> @@ -1240,11 +1254,17 @@ int dax_zero_page_range(struct inode *inode, loff_t from, unsigned length,
> .size = PAGE_SIZE,
> };
>
> - if (dax_map_atomic(bdev, &dax) < 0)
> - return PTR_ERR(dax.addr);
> - clear_pmem(dax.addr + offset, length);
> - wmb_pmem();
> - dax_unmap_atomic(bdev, &dax);
> + if (dax_range_is_aligned(bdev, &dax, offset, length))
> + return blkdev_issue_zeroout(bdev, dax.sector,
> + length / bdev_logical_block_size(bdev),
> + GFP_NOFS, true);
This is actually wrong. blkdev_issue_zeroout() expects length to be simply
in units of 512-bytes. So you need length >> 9 here.
Honza
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists