From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752585AbcEKRrH (ORCPT ); Wed, 11 May 2016 13:47:07 -0400 Received: from mga04.intel.com ([192.55.52.120]:63040 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752487AbcEKRrF (ORCPT ); Wed, 11 May 2016 13:47:05 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,608,1455004800"; d="scan'208";a="973676618" From: "Verma, Vishal L" To: "jack@suse.cz" CC: "linux-kernel@vger.kernel.org" , "linux-block@vger.kernel.org" , "hch@infradead.org" , "xfs@oss.sgi.com" , "jmoyer@redhat.com" , "linux-mm@kvack.org" , "Williams, Dan J" , "axboe@fb.com" , "akpm@linux-foundation.org" , "linux-nvdimm@lists.01.org" , "linux-fsdevel@vger.kernel.org" , "ross.zwisler@linux.intel.com" , "linux-ext4@vger.kernel.org" , "boaz@plexistor.com" , "david@fromorbit.com" Subject: Re: [PATCH v6 4/5] dax: for truncate/hole-punch, do zeroing through the driver if possible Thread-Topic: [PATCH v6 4/5] dax: for truncate/hole-punch, do zeroing through the driver if possible Thread-Index: AQHRquy+6jGeewZS+0Kt5vObFk9OpJ+z2hEAgACfnAA= Date: Wed, 11 May 2016 17:47:00 +0000 Message-ID: <1462988808.29294.26.camel@intel.com> References: <1462906156-22303-1-git-send-email-vishal.l.verma@intel.com> <1462906156-22303-5-git-send-email-vishal.l.verma@intel.com> <20160511081532.GB14744@quack2.suse.cz> In-Reply-To: <20160511081532.GB14744@quack2.suse.cz> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.232.112.171] Content-Type: text/plain; charset="utf-8" Content-ID: MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id u4BHlCn6025240 On Wed, 2016-05-11 at 10:15 +0200, Jan Kara wrote: > On Tue 10-05-16 12:49:15, Vishal Verma wrote: > > > > In the truncate or hole-punch path in dax, we clear out sub-page > > ranges. > > If these sub-page ranges are sector aligned and sized, we can do the > > zeroing through the driver instead so that error-clearing is handled > > automatically. > > > > For sub-sector ranges, we still have to rely on clear_pmem and have > > the > > possibility of tripping over errors. > > > > Cc: Dan Williams > > Cc: Ross Zwisler > > Cc: Jeff Moyer > > Cc: Christoph Hellwig > > Cc: Dave Chinner > > Cc: Jan Kara > > Reviewed-by: Christoph Hellwig > > Signed-off-by: Vishal Verma > ... > > > > > +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 (!IS_ALIGNED(((u64)dax->addr + offset), sector_size)) > One more question: 'dax' is initialized in dax_zero_page_range() and > dax->addr is going to be always NULL here. So either you forgot to > call > dax_map_atomic() to get the addr or the use of dax->addr is just bogus > (which is what I currently believe since I see no way how the address > could > be unaligned with the sector_size)... > Good catch, and you're right. I don't think I actually even want to use dax->addr for the alignment check here - I want to check if we're aligned to the block device sector. I'm thinking something like: if (!IS_ALIGNED(offset, sector_size)) Technically we want to check if sector * sector_size + offset is aligned, but the first part of that is already a sector :)