summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2019-10-11 21:14:36 +0200
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 23:08:29 +0200
commit821a99b7ba6802d43f980a8312cd25694b7ea076 (patch)
tree373f155c002548fba79912404c2229ced27c9d3b
parentbcachefs: Fix creation of lost+found (diff)
downloadlinux-821a99b7ba6802d43f980a8312cd25694b7ea076.tar.xz
linux-821a99b7ba6802d43f980a8312cd25694b7ea076.zip
bcachefs: Switch to .iterate_shared for readdir
We definitely don't need an exclusive inode lock for readdir. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r--fs/bcachefs/fs.c45
1 files changed, 13 insertions, 32 deletions
diff --git a/fs/bcachefs/fs.c b/fs/bcachefs/fs.c
index 0042a825a698..65556993bbb9 100644
--- a/fs/bcachefs/fs.c
+++ b/fs/bcachefs/fs.c
@@ -367,12 +367,12 @@ static struct dentry *bch2_lookup(struct inode *vdir, struct dentry *dentry,
return d_splice_alias(vinode, dentry);
}
-static int bch2_create(struct mnt_idmap *idmap,
- struct inode *vdir, struct dentry *dentry,
- umode_t mode, bool excl)
+static int bch2_mknod(struct mnt_idmap *idmap,
+ struct inode *vdir, struct dentry *dentry,
+ umode_t mode, dev_t rdev)
{
struct bch_inode_info *inode =
- __bch2_create(idmap, to_bch_ei(vdir), dentry, mode|S_IFREG, 0, false);
+ __bch2_create(idmap, to_bch_ei(vdir), dentry, mode, rdev, false);
if (IS_ERR(inode))
return PTR_ERR(inode);
@@ -381,6 +381,13 @@ static int bch2_create(struct mnt_idmap *idmap,
return 0;
}
+static int bch2_create(struct mnt_idmap *idmap,
+ struct inode *vdir, struct dentry *dentry,
+ umode_t mode, bool excl)
+{
+ return bch2_mknod(idmap, vdir, dentry, mode|S_IFREG, 0);
+}
+
static int __bch2_link(struct bch_fs *c,
struct bch_inode_info *inode,
struct bch_inode_info *dir,
@@ -512,33 +519,7 @@ err:
static int bch2_mkdir(struct mnt_idmap *idmap,
struct inode *vdir, struct dentry *dentry, umode_t mode)
{
- struct bch_inode_info *inode =
- __bch2_create(idmap, to_bch_ei(vdir), dentry, mode|S_IFDIR, 0, false);
-
- if (IS_ERR(inode))
- return PTR_ERR(inode);
-
- d_instantiate(dentry, &inode->v);
- return 0;
-}
-
-static int bch2_rmdir(struct inode *vdir, struct dentry *dentry)
-{
- return bch2_unlink(vdir, dentry);
-}
-
-static int bch2_mknod(struct mnt_idmap *idmap,
- struct inode *vdir, struct dentry *dentry,
- umode_t mode, dev_t rdev)
-{
- struct bch_inode_info *inode =
- __bch2_create(idmap, to_bch_ei(vdir), dentry, mode, rdev, false);
-
- if (IS_ERR(inode))
- return PTR_ERR(inode);
-
- d_instantiate(dentry, &inode->v);
- return 0;
+ return bch2_mknod(idmap, vdir, dentry, mode|S_IFDIR, 0);
}
static int bch2_rename2(struct mnt_idmap *idmap,
@@ -1034,7 +1015,7 @@ static const struct inode_operations bch_dir_inode_operations = {
.unlink = bch2_unlink,
.symlink = bch2_symlink,
.mkdir = bch2_mkdir,
- .rmdir = bch2_rmdir,
+ .rmdir = bch2_unlink,
.mknod = bch2_mknod,
.rename = bch2_rename2,
.getattr = bch2_getattr,