diff options
author | Ross Zwisler <ross.zwisler@linux.intel.com> | 2017-09-06 19:18:58 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-09-06 20:27:24 -0400 |
commit | 917f34526c4123ccd93e4373719c645c85020a5a (patch) | |
tree | bde4b4b2553a5078dc979c578a918f59372ed362 /fs/dax.c | |
parent | a2e050f5a9a9bd2b632d67bd06d87088e6a02dae (diff) |
dax: use PG_PMD_COLOUR instead of open coding
Use ~PG_PMD_COLOUR in dax_entry_waitqueue() instead of open coding an
equivalent page offset mask.
Link: http://lkml.kernel.org/r/20170822222436.18926-2-ross.zwisler@linux.intel.com
Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Cc: "Slusarz, Marcin" <marcin.slusarz@intel.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Matthew Wilcox <mawilcox@microsoft.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/dax.c')
-rw-r--r-- | fs/dax.c | 11 |
1 files changed, 4 insertions, 7 deletions
@@ -42,6 +42,9 @@ | |||
42 | #define DAX_WAIT_TABLE_BITS 12 | 42 | #define DAX_WAIT_TABLE_BITS 12 |
43 | #define DAX_WAIT_TABLE_ENTRIES (1 << DAX_WAIT_TABLE_BITS) | 43 | #define DAX_WAIT_TABLE_ENTRIES (1 << DAX_WAIT_TABLE_BITS) |
44 | 44 | ||
45 | /* The 'colour' (ie low bits) within a PMD of a page offset. */ | ||
46 | #define PG_PMD_COLOUR ((PMD_SIZE >> PAGE_SHIFT) - 1) | ||
47 | |||
45 | static wait_queue_head_t wait_table[DAX_WAIT_TABLE_ENTRIES]; | 48 | static wait_queue_head_t wait_table[DAX_WAIT_TABLE_ENTRIES]; |
46 | 49 | ||
47 | static int __init init_dax_wait_table(void) | 50 | static int __init init_dax_wait_table(void) |
@@ -132,7 +135,7 @@ static wait_queue_head_t *dax_entry_waitqueue(struct address_space *mapping, | |||
132 | * the range covered by the PMD map to the same bit lock. | 135 | * the range covered by the PMD map to the same bit lock. |
133 | */ | 136 | */ |
134 | if (dax_is_pmd_entry(entry)) | 137 | if (dax_is_pmd_entry(entry)) |
135 | index &= ~((1UL << (PMD_SHIFT - PAGE_SHIFT)) - 1); | 138 | index &= ~PG_PMD_COLOUR; |
136 | 139 | ||
137 | key->mapping = mapping; | 140 | key->mapping = mapping; |
138 | key->entry_start = index; | 141 | key->entry_start = index; |
@@ -1215,12 +1218,6 @@ static int dax_iomap_pte_fault(struct vm_fault *vmf, | |||
1215 | } | 1218 | } |
1216 | 1219 | ||
1217 | #ifdef CONFIG_FS_DAX_PMD | 1220 | #ifdef CONFIG_FS_DAX_PMD |
1218 | /* | ||
1219 | * The 'colour' (ie low bits) within a PMD of a page offset. This comes up | ||
1220 | * more often than one might expect in the below functions. | ||
1221 | */ | ||
1222 | #define PG_PMD_COLOUR ((PMD_SIZE >> PAGE_SHIFT) - 1) | ||
1223 | |||
1224 | static int dax_pmd_insert_mapping(struct vm_fault *vmf, struct iomap *iomap, | 1221 | static int dax_pmd_insert_mapping(struct vm_fault *vmf, struct iomap *iomap, |
1225 | loff_t pos, void *entry) | 1222 | loff_t pos, void *entry) |
1226 | { | 1223 | { |