[PATCH] bcachefs: Use str_write_read() helper function

Thorsten Blum posted 1 patch 1 month, 1 week ago
fs/bcachefs/journal_io.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
[PATCH] bcachefs: Use str_write_read() helper function
Posted by Thorsten Blum 1 month, 1 week ago
Remove hard-coded strings by using the helper function str_write_read().

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 fs/bcachefs/journal_io.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/bcachefs/journal_io.c b/fs/bcachefs/journal_io.c
index 954f6a96e0f4..325c39f90f65 100644
--- a/fs/bcachefs/journal_io.c
+++ b/fs/bcachefs/journal_io.c
@@ -17,6 +17,8 @@
 #include "sb-clean.h"
 #include "trace.h"
 
+#include <linux/string_choices.h>
+
 void bch2_journal_pos_from_member_info_set(struct bch_fs *c)
 {
 	lockdep_assert_held(&c->sb_lock);
@@ -665,7 +667,7 @@ static void journal_entry_clock_to_text(struct printbuf *out, struct bch_fs *c,
 	struct jset_entry_clock *clock =
 		container_of(entry, struct jset_entry_clock, entry);
 
-	prt_printf(out, "%s=%llu", clock->rw ? "write" : "read", le64_to_cpu(clock->time));
+	prt_printf(out, "%s=%llu", str_write_read(clock->rw), le64_to_cpu(clock->time));
 }
 
 static int journal_entry_dev_usage_validate(struct bch_fs *c,
-- 
2.47.0
Re: [PATCH] bcachefs: Use str_write_read() helper function
Posted by Kent Overstreet 1 month, 1 week ago
On Sat, Oct 19, 2024 at 02:25:27PM +0200, Thorsten Blum wrote:
> Remove hard-coded strings by using the helper function str_write_read().
> 
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>

Applied