From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from newverein.lst.de (verein.lst.de [213.95.11.211]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 4F16981F87 for ; Wed, 1 Feb 2017 00:10:22 -0800 (PST) Date: Wed, 1 Feb 2017 09:10:20 +0100 From: Christoph Hellwig Subject: Re: [RFC PATCH 10/17] block: introduce bdev_dax_direct_access() Message-ID: <20170201081020.GD29170@lst.de> References: <148559256378.11180.8957776806175202312.stgit@dwillia2-desk3.amr.corp.intel.com> <148559261791.11180.12085685820239925499.stgit@dwillia2-desk3.amr.corp.intel.com> <20170130123226.GD9043@lst.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" To: Dan Williams Cc: Mike Snitzer , Matthew Wilcox , "linux-nvdimm@lists.01.org" , linux-block@vger.kernel.org, linux-fsdevel , Christoph Hellwig List-ID: On Mon, Jan 30, 2017 at 10:16:29AM -0800, Dan Williams wrote: > Ok, now that dax_map_atomic() is gone, it's much easier to remove > struct blk_dax_ctl. > > We can also move the partition alignment checks to be a one-time check > at bdev_dax_capable() time and kill bdev_dax_direct_access() in favor > of calling dax_direct_access() directly. Yes, please. > >> + if ((sector + DIV_ROUND_UP(dax->size, 512)) > >> + > part_nr_sects_read(bdev->bd_part)) > >> + return -ERANGE; > >> + sector += get_start_sect(bdev); > >> + return dax_direct_access(dax_inode, sector * 512, &dax->addr, > >> + &dax->pfn, dax->size); > > > > And please switch to using bytes as the granularity given that we're > > deadling with byte addressable memory. > > dax_direct_access() does take a byte aligned physical address, but it > needs to be at least page aligned since we are returning a pfn_t... > > Hmm, perhaps the input should be raw page frame number. We could > reduce one of the arguments by making the current 'pfn_t *' parameter > an in/out-parameter. In/Out parameters are always a bit problematic in terms of API clarity. And updating a device-relative address with an absolute physical one sounds like an odd API for sure. _______________________________________________ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from verein.lst.de ([213.95.11.211]:33599 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751292AbdBAIK1 (ORCPT ); Wed, 1 Feb 2017 03:10:27 -0500 Date: Wed, 1 Feb 2017 09:10:20 +0100 From: Christoph Hellwig To: Dan Williams Cc: Christoph Hellwig , "linux-nvdimm@lists.01.org" , Mike Snitzer , Toshi Kani , Matthew Wilcox , linux-block@vger.kernel.org, jmoyer , linux-fsdevel , Ross Zwisler Subject: Re: [RFC PATCH 10/17] block: introduce bdev_dax_direct_access() Message-ID: <20170201081020.GD29170@lst.de> References: <148559256378.11180.8957776806175202312.stgit@dwillia2-desk3.amr.corp.intel.com> <148559261791.11180.12085685820239925499.stgit@dwillia2-desk3.amr.corp.intel.com> <20170130123226.GD9043@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: Sender: linux-block-owner@vger.kernel.org List-Id: linux-block@vger.kernel.org On Mon, Jan 30, 2017 at 10:16:29AM -0800, Dan Williams wrote: > Ok, now that dax_map_atomic() is gone, it's much easier to remove > struct blk_dax_ctl. > > We can also move the partition alignment checks to be a one-time check > at bdev_dax_capable() time and kill bdev_dax_direct_access() in favor > of calling dax_direct_access() directly. Yes, please. > >> + if ((sector + DIV_ROUND_UP(dax->size, 512)) > >> + > part_nr_sects_read(bdev->bd_part)) > >> + return -ERANGE; > >> + sector += get_start_sect(bdev); > >> + return dax_direct_access(dax_inode, sector * 512, &dax->addr, > >> + &dax->pfn, dax->size); > > > > And please switch to using bytes as the granularity given that we're > > deadling with byte addressable memory. > > dax_direct_access() does take a byte aligned physical address, but it > needs to be at least page aligned since we are returning a pfn_t... > > Hmm, perhaps the input should be raw page frame number. We could > reduce one of the arguments by making the current 'pfn_t *' parameter > an in/out-parameter. In/Out parameters are always a bit problematic in terms of API clarity. And updating a device-relative address with an absolute physical one sounds like an odd API for sure.