This series addresses several minor issues found using sparse.
cover This series addresses several minor issues found using sparse.
The first patch fixes a typo ('\%u') in a format specifier within a print statement. The incorrect sequence was replaced as it didn't appear to be the author's intent.
The second patch corrects the type for a function argument to __le64, which fixes two related sparse warnings. Although the argument data is already little-endian, using the specific __le64 type improves consistency and makes the expected data format explicit.
The third patch ensures cpu_to_le16() is used when preparing certain on-disk data (directory entry lengths). This maintains correct byte ordering for big-endian systems.
Gabriel Shahrouzi (3):
bcachefs: Fix escape sequence in prt_printf
bcachefs: Fix type for parameter in
journal_advance_devs_to_next_bucket
bcachefs: Use cpu_to_le16 for dirent lengths
fs/bcachefs/data_update.c | 2 +- fs/bcachefs/dirent.c | 4 ++-- fs/bcachefs/journal_io.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
Signature · 1 line
2.43.0
PATCH 1/3 bcachefs: Fix escape sequence in prt_printf
Remove backslash before format specifier. Ensure correct output.
--- fs/bcachefs/data_update.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/bcachefs/data_update.c +1 -1
@@ -607,7 +607,7 @@ void bch2_data_update_inflight_to_text(struct printbuf *out, struct data_updateprt_newline (out);printbuf_indent_add (out,2 );bch2_data_update_opts_to_text (out, m->op.c, &m->op.opts, &m->data_opts); -prt_printf (out,"read_done:\t\%u\n" , m->read_done); +prt_printf (out,"read_done:\t%u\n" , m->read_done);bch2_write_op_to_text (out, &m->op);printbuf_indent_sub (out,2 ); }
Signature · 1 line
2.43.0
PATCH 2/3 bcachefs: Fix type for parameter in journal_advance_devs_to_next_bucket
In reply to Gabriel ShahrouziReplace u64 with __le64 to match the expected parameter type. Ensure consistency both in function calls and within the function itself.
--- fs/bcachefs/journal_io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/bcachefs/journal_io.c +1 -1
@@ -1460,7 +1460,7 @@ int bch2_journal_read(struct bch_fs *c,static void journal_advance_devs_to_next_bucket (struct journal *j,struct dev_alloc_list *devs, -unsigned sectors,u64 seq) +unsigned sectors,__le64 seq) { struct bch_fs *c = container_of(j, struct bch_fs, journal);
Signature · 1 line
2.43.0
PATCH 3/3 bcachefs: Use cpu_to_le16 for dirent lengths
In reply to Gabriel ShahrouziPrevent incorrect byte ordering for big-endian systems.
--- fs/bcachefs/dirent.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/bcachefs/dirent.c +2 -2
@@ -287,8 +287,8 @@ static void dirent_init_casefolded_name(struct bkey_i_dirent *dirent,EBUG_ON (!dirent->v.d_casefold);EBUG_ON (!cf_name->len); - dirent->v.d_cf_name_block.d_name_len = name->len; - dirent->v.d_cf_name_block.d_cf_name_len = cf_name->len; + dirent->v.d_cf_name_block.d_name_len =cpu_to_le16 (name->len); + dirent->v.d_cf_name_block.d_cf_name_len =cpu_to_le16 (cf_name->len);memcpy (&dirent->v.d_cf_name_block.d_names[0 ], name->name, name->len);memcpy (&dirent->v.d_cf_name_block.d_names[name->len], cf_name->name, cf_name->len); memset(&dirent->v.d_cf_name_block.d_names[name->len + cf_name->len], 0,
Signature · 1 line
2.43.0
Quoted 4 lines · Gabriel Shahrouzi
The first patch fixes a typo ('\%u') in a format specifier within a print statement. The incorrect sequence was replaced as it didn't appear to be the author's intent.
Quoted 8 lines
The second patch corrects the type for a function argument to
__le64, which fixes two related sparse warnings. Although the argument data is already little-endian, using the specific__le64type improves consistency and makes the expected data format explicit.The third patch ensures
cpu_to_le16()is used when preparing certain on-disk data (directory entry lengths). This maintains correct byte ordering for big-endian systems.
Thanks, series is applied.
Quoted 15 lines
Gabriel Shahrouzi (3):
bcachefs: Fix escape sequence inprt_printf
bcachefs: Fix type for parameter in
journal_advance_devs_to_next_bucket
bcachefs: Usecpu_to_le16for dirent lengthsfs/bcachefs/data_update.c | 2 +- fs/bcachefs/dirent.c | 4 ++-- fs/bcachefs/journal_io.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)Signature · 1 line
2.43.0