summaryrefslogtreecommitdiff
path: root/fs/bcachefs/fs.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2019-06-29 17:59:21 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:08:24 -0400
commit5b6d40e2b670efc2feff4da9dd065053f5be31a7 (patch)
treec48c97797ae93fb259c510101159eb8bef9e8857 /fs/bcachefs/fs.c
parenta99b1caf473461d9269b693286533cc1b7c50d46 (diff)
downloadlwn-5b6d40e2b670efc2feff4da9dd065053f5be31a7.tar.gz
lwn-5b6d40e2b670efc2feff4da9dd065053f5be31a7.zip
bcachefs: Export correct blocksize to vfs
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/fs.c')
-rw-r--r--fs/bcachefs/fs.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/fs/bcachefs/fs.c b/fs/bcachefs/fs.c
index 1b3898eae8b8..54e555fb4d5d 100644
--- a/fs/bcachefs/fs.c
+++ b/fs/bcachefs/fs.c
@@ -1147,7 +1147,8 @@ static int bch2_tmpfile(struct mnt_idmap *idmap,
return finish_open_simple(file, 0);
}
-static int bch2_fill_extent(struct fiemap_extent_info *info,
+static int bch2_fill_extent(struct bch_fs *c,
+ struct fiemap_extent_info *info,
struct bkey_s_c k, unsigned flags)
{
if (bkey_extent_is_data(k.k)) {
@@ -1165,8 +1166,8 @@ static int bch2_fill_extent(struct fiemap_extent_info *info,
else
offset += p.crc.offset;
- if ((offset & (PAGE_SECTORS - 1)) ||
- (k.k->size & (PAGE_SECTORS - 1)))
+ if ((offset & (c->opts.block_size - 1)) ||
+ (k.k->size & (c->opts.block_size - 1)))
flags2 |= FIEMAP_EXTENT_NOT_ALIGNED;
ret = fiemap_fill_next_extent(info,
@@ -1223,7 +1224,7 @@ static int bch2_fiemap(struct inode *vinode, struct fiemap_extent_info *info,
if (bkey_extent_is_data(k.k) ||
k.k->type == KEY_TYPE_reservation) {
if (have_extent) {
- ret = bch2_fill_extent(info,
+ ret = bch2_fill_extent(c, info,
bkey_i_to_s_c(&prev.k), 0);
if (ret)
break;
@@ -1235,7 +1236,7 @@ static int bch2_fiemap(struct inode *vinode, struct fiemap_extent_info *info,
}
if (!ret && have_extent)
- ret = bch2_fill_extent(info, bkey_i_to_s_c(&prev.k),
+ ret = bch2_fill_extent(c, info, bkey_i_to_s_c(&prev.k),
FIEMAP_EXTENT_LAST);
ret = bch2_trans_exit(&trans) ?: ret;
@@ -1803,9 +1804,8 @@ static struct dentry *bch2_mount(struct file_system_type *fs_type,
goto out;
}
- /* XXX: blocksize */
- sb->s_blocksize = PAGE_SIZE;
- sb->s_blocksize_bits = PAGE_SHIFT;
+ sb->s_blocksize = block_bytes(c);
+ sb->s_blocksize_bits = ilog2(block_bytes(c));
sb->s_maxbytes = MAX_LFS_FILESIZE;
sb->s_op = &bch_super_operations;
sb->s_export_op = &bch_export_ops;