summaryrefslogtreecommitdiff
path: root/fs/bcachefs/fs-io.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2021-07-21 04:18:16 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:09:09 +0300
commitb97bbd4ec35d5359398513d381345765cd80c012 (patch)
treefd331023d93db23ae5ed334dde9a40611554c61e /fs/bcachefs/fs-io.c
parent4909fe50b31ad919d998329002d707dd097094ff (diff)
downloadlinux-b97bbd4ec35d5359398513d381345765cd80c012.tar.xz
bcachefs: Use bch2_inode_find_by_inum() in truncate
This is needed for snapshots because we need to start handling lock restarts even when just calling bch2_inode_peek(). Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/fs-io.c')
-rw-r--r--fs/bcachefs/fs-io.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c
index 30c12864d537..4af8cd018e3a 100644
--- a/fs/bcachefs/fs-io.c
+++ b/fs/bcachefs/fs-io.c
@@ -2296,8 +2296,6 @@ int bch2_truncate(struct mnt_idmap *idmap,
struct bch_fs *c = inode->v.i_sb->s_fs_info;
struct address_space *mapping = inode->v.i_mapping;
struct bch_inode_unpacked inode_u;
- struct btree_trans trans;
- struct btree_iter *iter;
u64 new_i_size = iattr->ia_size;
s64 i_sectors_delta = 0;
int ret = 0;
@@ -2318,16 +2316,7 @@ int bch2_truncate(struct mnt_idmap *idmap,
inode_dio_wait(&inode->v);
bch2_pagecache_block_get(&inode->ei_pagecache_lock);
- /*
- * fetch current on disk i_size: inode is locked, i_size can only
- * increase underneath us:
- */
- bch2_trans_init(&trans, c, 0, 0);
- iter = bch2_inode_peek(&trans, &inode_u, inode->v.i_ino, 0);
- ret = PTR_ERR_OR_ZERO(iter);
- bch2_trans_iter_put(&trans, iter);
- bch2_trans_exit(&trans);
-
+ ret = bch2_inode_find_by_inum(c, inode->v.i_ino, &inode_u);
if (ret)
goto err;