2017-08-17 16:08:07

by Jan Kara

[permalink] [raw]
Subject: [PATCH 05/13] dax: Create local variable for vmf->flags & FAULT_FLAG_WRITE test

There are already two users and more are coming.

Signed-off-by: Jan Kara <[email protected]>
---
fs/dax.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/dax.c b/fs/dax.c
index 75aa0d9fb39f..7c150eddc01a 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -1105,6 +1105,7 @@ static int dax_iomap_pte_fault(struct vm_fault *vmf,
struct iomap iomap = { 0 };
unsigned flags = IOMAP_FAULT;
int error, major = 0;
+ bool write = vmf->flags & FAULT_FLAG_WRITE;
int vmf_ret = 0;
void *entry;

@@ -1119,7 +1120,7 @@ static int dax_iomap_pte_fault(struct vm_fault *vmf,
goto out;
}

- if ((vmf->flags & FAULT_FLAG_WRITE) && !vmf->cow_page)
+ if (write && !vmf->cow_page)
flags |= IOMAP_WRITE;

entry = grab_mapping_entry(mapping, vmf->pgoff, 0);
@@ -1196,7 +1197,7 @@ static int dax_iomap_pte_fault(struct vm_fault *vmf,
break;
case IOMAP_UNWRITTEN:
case IOMAP_HOLE:
- if (!(vmf->flags & FAULT_FLAG_WRITE)) {
+ if (!write) {
vmf_ret = dax_load_hole(mapping, entry, vmf);
goto finish_iomap;
}
--
2.12.3


2017-08-18 22:08:52

by Ross Zwisler

[permalink] [raw]
Subject: Re: [PATCH 05/13] dax: Create local variable for vmf->flags & FAULT_FLAG_WRITE test

On Thu, Aug 17, 2017 at 06:08:07PM +0200, Jan Kara wrote:
> There are already two users and more are coming.
>
> Signed-off-by: Jan Kara <[email protected]>

Sure, and this is much nicer to read.

Reviewed-by: Ross Zwisler <ross.zwisler-VuQAYsv1563Yd54FQh9/[email protected]>