aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQu Wenruo <wqu@suse.com>2022-07-26 13:22:16 +0800
committerTom Rini <trini@konsulko.com>2022-08-05 13:25:48 -0400
commit8d45fd3c717f8d334df9934b36789117574dc907 (patch)
tree8d3f392d752f193aa0470d00f8a0500f5b3bba42
parente3e4f562192f5a1558eb5f95b359930bafebff78 (diff)
downloadu-boot-WIP/2022-08-05-fs-add-generic-unaligned-read-offset-handling.zip
u-boot-WIP/2022-08-05-fs-add-generic-unaligned-read-offset-handling.tar.gz
u-boot-WIP/2022-08-05-fs-add-generic-unaligned-read-offset-handling.tar.bz2
fs: erofs: add unaligned read range handlingWIP/2022-08-05-fs-add-generic-unaligned-read-offset-handling
I'm not an expert on erofs, but my quick glance didn't expose any special handling on unaligned range, thus I think the U-boot erofs driver doesn't really support unaligned read range. This patch will add erofs_get_blocksize() so erofs can benefit from the generic unaligned read support. Cc: Huang Jianan <jnhuang95@gmail.com> Cc: linux-erofs@lists.ozlabs.org Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Huang Jianan <jnhuang95@gmail.com>
-rw-r--r--fs/erofs/internal.h1
-rw-r--r--fs/erofs/super.c6
-rw-r--r--fs/fs.c2
-rw-r--r--include/erofs.h1
4 files changed, 9 insertions, 1 deletions
diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h
index 4af7c91..d368a64 100644
--- a/fs/erofs/internal.h
+++ b/fs/erofs/internal.h
@@ -83,6 +83,7 @@ struct erofs_sb_info {
u16 available_compr_algs;
u16 lz4_max_distance;
u32 checksum;
+ u32 blocksize;
u16 extra_devices;
union {
u16 devt_slotoff; /* used for mkfs */
diff --git a/fs/erofs/super.c b/fs/erofs/super.c
index 4cca322..df01d2e 100644
--- a/fs/erofs/super.c
+++ b/fs/erofs/super.c
@@ -99,7 +99,13 @@ int erofs_read_superblock(void)
sbi.build_time = le64_to_cpu(dsb->build_time);
sbi.build_time_nsec = le32_to_cpu(dsb->build_time_nsec);
+ sbi.blocksize = 1 << blkszbits;
memcpy(&sbi.uuid, dsb->uuid, sizeof(dsb->uuid));
return erofs_init_devices(&sbi, dsb);
}
+
+int erofs_get_blocksize(const char *filename)
+{
+ return sbi.blocksize;
+}
diff --git a/fs/fs.c b/fs/fs.c
index 2b847d8..23cfb1f 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -375,7 +375,7 @@ static struct fstype_info fstypes[] = {
.readdir = erofs_readdir,
.ls = fs_ls_generic,
.read = erofs_read,
- .get_blocksize = fs_get_blocksize_unsupported,
+ .get_blocksize = erofs_get_blocksize,
.size = erofs_size,
.close = erofs_close,
.closedir = erofs_closedir,
diff --git a/include/erofs.h b/include/erofs.h
index 1fbe82b..18bd680 100644
--- a/include/erofs.h
+++ b/include/erofs.h
@@ -10,6 +10,7 @@ int erofs_probe(struct blk_desc *fs_dev_desc,
struct disk_partition *fs_partition);
int erofs_read(const char *filename, void *buf, loff_t offset,
loff_t len, loff_t *actread);
+int erofs_get_blocksize(const char *filename);
int erofs_size(const char *filename, loff_t *size);
int erofs_exists(const char *filename);
void erofs_close(void);