diff mbox

[v7,07/61] fscache: Use appropriate radix tree accessors

Message ID 20180219194556.6575-8-willy@infradead.org (mailing list archive)
State New, archived
Headers show

Commit Message

Matthew Wilcox Feb. 19, 2018, 7:45 p.m. UTC
From: Matthew Wilcox <mawilcox@microsoft.com>

Don't open-code accesses to data structure internals.

Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
---
 fs/fscache/cookie.c | 2 +-
 fs/fscache/object.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Jeff Layton March 3, 2018, 1:57 p.m. UTC | #1
On Mon, 2018-02-19 at 11:45 -0800, Matthew Wilcox wrote:
> From: Matthew Wilcox <mawilcox@microsoft.com>
> 
> Don't open-code accesses to data structure internals.
> 
> Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
> ---
>  fs/fscache/cookie.c | 2 +-
>  fs/fscache/object.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/fscache/cookie.c b/fs/fscache/cookie.c
> index ff84258132bb..e9054e0c1a49 100644
> --- a/fs/fscache/cookie.c
> +++ b/fs/fscache/cookie.c
> @@ -608,7 +608,7 @@ void __fscache_relinquish_cookie(struct fscache_cookie *cookie, bool retire)
>  	/* Clear pointers back to the netfs */
>  	cookie->netfs_data	= NULL;
>  	cookie->def		= NULL;
> -	BUG_ON(cookie->stores.rnode);
> +	BUG_ON(!radix_tree_empty(&cookie->stores));
>  
>  	if (cookie->parent) {
>  		ASSERTCMP(atomic_read(&cookie->parent->usage), >, 0);
> diff --git a/fs/fscache/object.c b/fs/fscache/object.c
> index 7a182c87f378..aa0e71f02c33 100644
> --- a/fs/fscache/object.c
> +++ b/fs/fscache/object.c
> @@ -956,7 +956,7 @@ static const struct fscache_state *_fscache_invalidate_object(struct fscache_obj
>  	 * retire the object instead.
>  	 */
>  	if (!fscache_use_cookie(object)) {
> -		ASSERT(object->cookie->stores.rnode == NULL);
> +		ASSERT(radix_tree_empty(&object->cookie->stores));
>  		set_bit(FSCACHE_OBJECT_RETIRED, &object->flags);
>  		_leave(" [no cookie]");
>  		return transit_to(KILL_OBJECT);

Reviewed-by: Jeff Layton <jlayton@redhat.com>
diff mbox

Patch

diff --git a/fs/fscache/cookie.c b/fs/fscache/cookie.c
index ff84258132bb..e9054e0c1a49 100644
--- a/fs/fscache/cookie.c
+++ b/fs/fscache/cookie.c
@@ -608,7 +608,7 @@  void __fscache_relinquish_cookie(struct fscache_cookie *cookie, bool retire)
 	/* Clear pointers back to the netfs */
 	cookie->netfs_data	= NULL;
 	cookie->def		= NULL;
-	BUG_ON(cookie->stores.rnode);
+	BUG_ON(!radix_tree_empty(&cookie->stores));
 
 	if (cookie->parent) {
 		ASSERTCMP(atomic_read(&cookie->parent->usage), >, 0);
diff --git a/fs/fscache/object.c b/fs/fscache/object.c
index 7a182c87f378..aa0e71f02c33 100644
--- a/fs/fscache/object.c
+++ b/fs/fscache/object.c
@@ -956,7 +956,7 @@  static const struct fscache_state *_fscache_invalidate_object(struct fscache_obj
 	 * retire the object instead.
 	 */
 	if (!fscache_use_cookie(object)) {
-		ASSERT(object->cookie->stores.rnode == NULL);
+		ASSERT(radix_tree_empty(&object->cookie->stores));
 		set_bit(FSCACHE_OBJECT_RETIRED, &object->flags);
 		_leave(" [no cookie]");
 		return transit_to(KILL_OBJECT);