Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755498AbdGXLtP (ORCPT ); Mon, 24 Jul 2017 07:49:15 -0400 Received: from mx2.suse.de ([195.135.220.15]:53933 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751482AbdGXLtE (ORCPT ); Mon, 24 Jul 2017 07:49:04 -0400 Date: Mon, 24 Jul 2017 13:48:59 +0200 From: Jan Kara To: Ross Zwisler Cc: Andrew Morton , linux-kernel@vger.kernel.org, "Darrick J. Wong" , "Theodore Ts'o" , Alexander Viro , Andreas Dilger , Christoph Hellwig , Dan Williams , Dave Chinner , David Airlie , Ingo Molnar , Inki Dae , Jan Kara , Jonathan Corbet , Joonyoung Shim , Krzysztof Kozlowski , Kukjin Kim , Kyungmin Park , Matthew Wilcox , Patrik Jakobsson , Rob Clark , Seung-Woo Kim , Steven Rostedt , Tomi Valkeinen , dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-doc@vger.kernel.org, linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-nvdimm@lists.01.org, linux-samsung-soc@vger.kernel.org, linux-xfs@vger.kernel.org Subject: Re: [PATCH v4 5/5] dax: move all DAX radix tree defs to fs/dax.c Message-ID: <20170724114859.GM652@quack2.suse.cz> References: <20170721223956.29485-1-ross.zwisler@linux.intel.com> <20170721223956.29485-6-ross.zwisler@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170721223956.29485-6-ross.zwisler@linux.intel.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4522 Lines: 131 On Fri 21-07-17 16:39:55, Ross Zwisler wrote: > Now that we no longer insert struct page pointers in DAX radix trees the > page cache code no longer needs to know anything about DAX exceptional > entries. Move all the DAX exceptional entry definitions from dax.h to > fs/dax.c. > > Signed-off-by: Ross Zwisler > Suggested-by: Jan Kara Looks good. You can add: Reviewed-by: Jan Kara Honza > --- > fs/dax.c | 34 ++++++++++++++++++++++++++++++++++ > include/linux/dax.h | 41 ----------------------------------------- > 2 files changed, 34 insertions(+), 41 deletions(-) > > diff --git a/fs/dax.c b/fs/dax.c > index 0e27d90..e7acc45 100644 > --- a/fs/dax.c > +++ b/fs/dax.c > @@ -54,6 +54,40 @@ static int __init init_dax_wait_table(void) > } > fs_initcall(init_dax_wait_table); > > +/* > + * We use lowest available bit in exceptional entry for locking, one bit for > + * the entry size (PMD) and two more to tell us if the entry is a zero page or > + * an empty entry that is just used for locking. In total four special bits. > + * > + * If the PMD bit isn't set the entry has size PAGE_SIZE, and if the ZERO_PAGE > + * and EMPTY bits aren't set the entry is a normal DAX entry with a filesystem > + * block allocation. > + */ > +#define RADIX_DAX_SHIFT (RADIX_TREE_EXCEPTIONAL_SHIFT + 4) > +#define RADIX_DAX_ENTRY_LOCK (1 << RADIX_TREE_EXCEPTIONAL_SHIFT) > +#define RADIX_DAX_PMD (1 << (RADIX_TREE_EXCEPTIONAL_SHIFT + 1)) > +#define RADIX_DAX_ZERO_PAGE (1 << (RADIX_TREE_EXCEPTIONAL_SHIFT + 2)) > +#define RADIX_DAX_EMPTY (1 << (RADIX_TREE_EXCEPTIONAL_SHIFT + 3)) > + > +static unsigned long dax_radix_sector(void *entry) > +{ > + return (unsigned long)entry >> RADIX_DAX_SHIFT; > +} > + > +static void *dax_radix_locked_entry(sector_t sector, unsigned long flags) > +{ > + return (void *)(RADIX_TREE_EXCEPTIONAL_ENTRY | flags | > + ((unsigned long)sector << RADIX_DAX_SHIFT) | > + RADIX_DAX_ENTRY_LOCK); > +} > + > +static unsigned int dax_radix_order(void *entry) > +{ > + if ((unsigned long)entry & RADIX_DAX_PMD) > + return PMD_SHIFT - PAGE_SHIFT; > + return 0; > +} > + > static int dax_is_pmd_entry(void *entry) > { > return (unsigned long)entry & RADIX_DAX_PMD; > diff --git a/include/linux/dax.h b/include/linux/dax.h > index afa99bb..d0e3272 100644 > --- a/include/linux/dax.h > +++ b/include/linux/dax.h > @@ -88,33 +88,6 @@ void dax_flush(struct dax_device *dax_dev, pgoff_t pgoff, void *addr, > size_t size); > void dax_write_cache(struct dax_device *dax_dev, bool wc); > > -/* > - * We use lowest available bit in exceptional entry for locking, one bit for > - * the entry size (PMD) and two more to tell us if the entry is a zero page or > - * an empty entry that is just used for locking. In total four special bits. > - * > - * If the PMD bit isn't set the entry has size PAGE_SIZE, and if the ZERO_PAGE > - * and EMPTY bits aren't set the entry is a normal DAX entry with a filesystem > - * block allocation. > - */ > -#define RADIX_DAX_SHIFT (RADIX_TREE_EXCEPTIONAL_SHIFT + 4) > -#define RADIX_DAX_ENTRY_LOCK (1 << RADIX_TREE_EXCEPTIONAL_SHIFT) > -#define RADIX_DAX_PMD (1 << (RADIX_TREE_EXCEPTIONAL_SHIFT + 1)) > -#define RADIX_DAX_ZERO_PAGE (1 << (RADIX_TREE_EXCEPTIONAL_SHIFT + 2)) > -#define RADIX_DAX_EMPTY (1 << (RADIX_TREE_EXCEPTIONAL_SHIFT + 3)) > - > -static inline unsigned long dax_radix_sector(void *entry) > -{ > - return (unsigned long)entry >> RADIX_DAX_SHIFT; > -} > - > -static inline void *dax_radix_locked_entry(sector_t sector, unsigned long flags) > -{ > - return (void *)(RADIX_TREE_EXCEPTIONAL_ENTRY | flags | > - ((unsigned long)sector << RADIX_DAX_SHIFT) | > - RADIX_DAX_ENTRY_LOCK); > -} > - > ssize_t dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter, > const struct iomap_ops *ops); > int dax_iomap_fault(struct vm_fault *vmf, enum page_entry_size pe_size, > @@ -136,20 +109,6 @@ static inline int __dax_zero_page_range(struct block_device *bdev, > } > #endif > > -#ifdef CONFIG_FS_DAX_PMD > -static inline unsigned int dax_radix_order(void *entry) > -{ > - if ((unsigned long)entry & RADIX_DAX_PMD) > - return PMD_SHIFT - PAGE_SHIFT; > - return 0; > -} > -#else > -static inline unsigned int dax_radix_order(void *entry) > -{ > - return 0; > -} > -#endif > - > static inline bool dax_mapping(struct address_space *mapping) > { > return mapping->host && IS_DAX(mapping->host); > -- > 2.9.4 > -- Jan Kara SUSE Labs, CR