Skip to contentSkip to conversation

btrfs: fix extent_buffer_uptodate() return

PATCH In review Anand Jain 2 participants 3 messages Feb 12, 2018 – Feb 13, 2018 Btrfs file system

lore
Share & tools
lore

Anand Jain

author
#0 lore raw

PATCH 1/1 btrfs: fix extent_buffer_uptodate() return

extent_buffer_uptodate() returns from test_bit() which is of type bool, so update extent_buffer_uptodate() to it.

---
 fs/btrfs/extent_io.c | 2 +-
 fs/btrfs/extent_io.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
fs/btrfs/extent_io.c +1 -1
index bae57b408901..96879c1c1651 100644
@@ -5229,7 +5229,7 @@ void set_extent_buffer_uptodate(struct extent_buffer *eb)
 	}
 }
 
-int extent_buffer_uptodate(struct extent_buffer *eb)
+bool extent_buffer_uptodate(struct extent_buffer *eb)
 {
 	return test_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags);
 }
fs/btrfs/extent_io.h +1 -1
index 72e5af2965a8..d4ea3a2070ee 100644
@@ -489,7 +489,7 @@ void clear_extent_buffer_dirty(struct extent_buffer *eb);
 int set_extent_buffer_dirty(struct extent_buffer *eb);
 void set_extent_buffer_uptodate(struct extent_buffer *eb);
 void clear_extent_buffer_uptodate(struct extent_buffer *eb);
-int extent_buffer_uptodate(struct extent_buffer *eb);
+bool extent_buffer_uptodate(struct extent_buffer *eb);
 int extent_buffer_under_io(struct extent_buffer *eb);
 int map_private_extent_buffer(const struct extent_buffer *eb,
 			      unsigned long offset, unsigned long min_len,
Signature · 1 line
2.15.0
#1 lore raw
Quoted 2 lines · Anand Jain

extent_buffer_uptodate() returns from test_bit() which is of type bool, so update extent_buffer_uptodate() to it.

The return value of test_bit differes by architecture, there are several that return int. You probably refer to x86 that uses some trickery to optimize for constants and that returns bool. While we can add more int/bool, I don't think it's wrong to have int here so I don't see what this patch fixes.

In this particular case, extent_buffer_uptodate is a trivial wrapper around test_bit so it would be better to make it a static inline. This would remove the call indirection and reduce size of the code.

author
#2 lore raw
Quoted 9 lines · David Sterba
Quoted 2 lines · Anand Jain

extent_buffer_uptodate() returns from test_bit() which is of type bool, so update extent_buffer_uptodate() to it.

The return value of test_bit differes by architecture, there are several that return int. You probably refer to x86 that uses some trickery to optimize for constants and that returns bool. While we can add more int/bool, I don't think it's wrong to have int here so I don't see what this patch fixes.

Ah the other arch(s) I didn't go that deep, thanks for pointing out. Yes pls ignore this patch.

Quoted 3 lines

In this particular case, extent_buffer_uptodate is a trivial wrapper around test_bit so it would be better to make it a static inline. This would remove the call indirection and reduce size of the code.

Ok. Will fix that while here.

Thanks, Anand

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html