diff options
author | Joshua Ashton <joshua@froggi.es> | 2023-08-12 22:26:29 +0100 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:10:10 -0400 |
commit | 01a7e74fe14179cba90bf3f52ad3188a1d6819d2 (patch) | |
tree | 494b7ca69d8ba0ebf9ebff827d9b8b53319ca481 /fs/bcachefs/fs.c | |
parent | f854ce4d0a3f7281b5b99b28dd028abe21c1b0c8 (diff) | |
download | linux-01a7e74fe14179cba90bf3f52ad3188a1d6819d2.tar.gz linux-01a7e74fe14179cba90bf3f52ad3188a1d6819d2.tar.bz2 linux-01a7e74fe14179cba90bf3f52ad3188a1d6819d2.zip |
bcachefs: Introduce bch2_dirent_get_name
A nice cleanup that avoids a bunch of open-coding name/string usage
around dirent usage.
Will be used by casefolding impl in future commits.
Signed-off-by: Joshua Ashton <joshua@froggi.es>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/fs.c')
-rw-r--r-- | fs/bcachefs/fs.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/bcachefs/fs.c b/fs/bcachefs/fs.c index 113518ebd095..0e1b31707d80 100644 --- a/fs/bcachefs/fs.c +++ b/fs/bcachefs/fs.c @@ -1237,7 +1237,8 @@ static int bch2_get_name(struct dentry *parent, char *name, struct dentry *child struct bch_inode_unpacked inode_u; subvol_inum target; u32 snapshot; - unsigned name_len; + struct qstr dirent_name; + unsigned name_len = 0; int ret; if (!S_ISDIR(dir->v.i_mode)) @@ -1314,9 +1315,10 @@ retry: ret = -ENOENT; goto err; found: - name_len = min_t(unsigned, bch2_dirent_name_bytes(d), NAME_MAX); + dirent_name = bch2_dirent_get_name(d); - memcpy(name, d.v->d_name, name_len); + name_len = min_t(unsigned, dirent_name.len, NAME_MAX); + memcpy(name, dirent_name.name, name_len); name[name_len] = '\0'; err: if (bch2_err_matches(ret, BCH_ERR_transaction_restart)) |