2016-10-12 22:50:19

by Ross Zwisler

[permalink] [raw]
Subject: [PATCH v6 14/17] dax: move put_(un)locked_mapping_entry() in dax.c

No functional change.

The static functions put_locked_mapping_entry() and
put_unlocked_mapping_entry() will soon be used in error cases in
grab_mapping_entry(), so move their definitions above this function.

Signed-off-by: Ross Zwisler <ross.zwisler-VuQAYsv1563Yd54FQh9/[email protected]>
---
fs/dax.c | 50 +++++++++++++++++++++++++-------------------------
1 file changed, 25 insertions(+), 25 deletions(-)

diff --git a/fs/dax.c b/fs/dax.c
index c45cc4d..0582c7c 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -382,6 +382,31 @@ static void *get_unlocked_mapping_entry(struct address_space *mapping,
}
}

+static void put_locked_mapping_entry(struct address_space *mapping,
+ pgoff_t index, void *entry)
+{
+ if (!radix_tree_exceptional_entry(entry)) {
+ unlock_page(entry);
+ put_page(entry);
+ } else {
+ dax_unlock_mapping_entry(mapping, index);
+ }
+}
+
+/*
+ * Called when we are done with radix tree entry we looked up via
+ * get_unlocked_mapping_entry() and which we didn't lock in the end.
+ */
+static void put_unlocked_mapping_entry(struct address_space *mapping,
+ pgoff_t index, void *entry)
+{
+ if (!radix_tree_exceptional_entry(entry))
+ return;
+
+ /* We have to wake up next waiter for the radix tree entry lock */
+ dax_wake_mapping_entry_waiter(mapping, index, entry, false);
+}
+
/*
* Find radix tree entry at given index. If it points to a page, return with
* the page locked. If it points to the exceptional entry, return with the
@@ -486,31 +511,6 @@ void dax_unlock_mapping_entry(struct address_space *mapping, pgoff_t index)
dax_wake_mapping_entry_waiter(mapping, index, entry, false);
}

-static void put_locked_mapping_entry(struct address_space *mapping,
- pgoff_t index, void *entry)
-{
- if (!radix_tree_exceptional_entry(entry)) {
- unlock_page(entry);
- put_page(entry);
- } else {
- dax_unlock_mapping_entry(mapping, index);
- }
-}
-
-/*
- * Called when we are done with radix tree entry we looked up via
- * get_unlocked_mapping_entry() and which we didn't lock in the end.
- */
-static void put_unlocked_mapping_entry(struct address_space *mapping,
- pgoff_t index, void *entry)
-{
- if (!radix_tree_exceptional_entry(entry))
- return;
-
- /* We have to wake up next waiter for the radix tree entry lock */
- dax_wake_mapping_entry_waiter(mapping, index, entry, false);
-}
-
/*
* Delete exceptional DAX entry at @index from @mapping. Wait for radix tree
* entry to get unlocked before deleting it.
--
2.9.0


2016-10-13 15:11:49

by Jan Kara

[permalink] [raw]
Subject: Re: [PATCH v6 14/17] dax: move put_(un)locked_mapping_entry() in dax.c

On Wed 12-10-16 16:50:19, Ross Zwisler wrote:
> No functional change.
>
> The static functions put_locked_mapping_entry() and
> put_unlocked_mapping_entry() will soon be used in error cases in
> grab_mapping_entry(), so move their definitions above this function.
>
> Signed-off-by: Ross Zwisler <[email protected]>

Looks good. You can add:

Reviewed-by: Jan Kara <[email protected]>

Honza

> ---
> fs/dax.c | 50 +++++++++++++++++++++++++-------------------------
> 1 file changed, 25 insertions(+), 25 deletions(-)
>
> diff --git a/fs/dax.c b/fs/dax.c
> index c45cc4d..0582c7c 100644
> --- a/fs/dax.c
> +++ b/fs/dax.c
> @@ -382,6 +382,31 @@ static void *get_unlocked_mapping_entry(struct address_space *mapping,
> }
> }
>
> +static void put_locked_mapping_entry(struct address_space *mapping,
> + pgoff_t index, void *entry)
> +{
> + if (!radix_tree_exceptional_entry(entry)) {
> + unlock_page(entry);
> + put_page(entry);
> + } else {
> + dax_unlock_mapping_entry(mapping, index);
> + }
> +}
> +
> +/*
> + * Called when we are done with radix tree entry we looked up via
> + * get_unlocked_mapping_entry() and which we didn't lock in the end.
> + */
> +static void put_unlocked_mapping_entry(struct address_space *mapping,
> + pgoff_t index, void *entry)
> +{
> + if (!radix_tree_exceptional_entry(entry))
> + return;
> +
> + /* We have to wake up next waiter for the radix tree entry lock */
> + dax_wake_mapping_entry_waiter(mapping, index, entry, false);
> +}
> +
> /*
> * Find radix tree entry at given index. If it points to a page, return with
> * the page locked. If it points to the exceptional entry, return with the
> @@ -486,31 +511,6 @@ void dax_unlock_mapping_entry(struct address_space *mapping, pgoff_t index)
> dax_wake_mapping_entry_waiter(mapping, index, entry, false);
> }
>
> -static void put_locked_mapping_entry(struct address_space *mapping,
> - pgoff_t index, void *entry)
> -{
> - if (!radix_tree_exceptional_entry(entry)) {
> - unlock_page(entry);
> - put_page(entry);
> - } else {
> - dax_unlock_mapping_entry(mapping, index);
> - }
> -}
> -
> -/*
> - * Called when we are done with radix tree entry we looked up via
> - * get_unlocked_mapping_entry() and which we didn't lock in the end.
> - */
> -static void put_unlocked_mapping_entry(struct address_space *mapping,
> - pgoff_t index, void *entry)
> -{
> - if (!radix_tree_exceptional_entry(entry))
> - return;
> -
> - /* We have to wake up next waiter for the radix tree entry lock */
> - dax_wake_mapping_entry_waiter(mapping, index, entry, false);
> -}
> -
> /*
> * Delete exceptional DAX entry at @index from @mapping. Wait for radix tree
> * entry to get unlocked before deleting it.
> --
> 2.9.0
>
--
Jan Kara <[email protected]>
SUSE Labs, CR

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>