From: Qu Wenruo <wqu@suse.com> To: u-boot@lists.denx.de Cc: marek.behun@nic.cz, linux-btrfs@vger.kernel.org, jnhuang95@gmail.com, linux-erofs@lists.ozlabs.org, trini@konsulko.com, joaomarcos.costa@bootlin.com, thomas.petazzoni@bootlin.com, miquel.raynal@bootlin.com Subject: [PATCH v3 8/8] fs: erofs: add unaligned read range handling Date: Mon, 15 Aug 2022 19:45:19 +0800 [thread overview] Message-ID: <a1ac116d3416d13161312a5a08c4d0e9f6218639.1660563403.git.wqu@suse.com> (raw) In-Reply-To: <cover.1660563403.git.wqu@suse.com> 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> --- fs/erofs/internal.h | 1 + fs/erofs/super.c | 6 ++++++ fs/fs.c | 2 +- include/erofs.h | 1 + 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h index 4af7c91560cc..d368a6481bf1 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 8277d9b53fb3..82625da59001 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 43c7128bcfc5..2ac43c05fcd8 100644 --- a/fs/fs.c +++ b/fs/fs.c @@ -376,7 +376,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 1fbe82bf72cb..18bd6807c538 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); -- 2.37.1
WARNING: multiple messages have this Message-ID (diff)
From: Qu Wenruo via Linux-erofs <linux-erofs@lists.ozlabs.org> To: u-boot@lists.denx.de Cc: trini@konsulko.com, joaomarcos.costa@bootlin.com, marek.behun@nic.cz, thomas.petazzoni@bootlin.com, miquel.raynal@bootlin.com, linux-erofs@lists.ozlabs.org, linux-btrfs@vger.kernel.org Subject: [PATCH v3 8/8] fs: erofs: add unaligned read range handling Date: Mon, 15 Aug 2022 19:45:19 +0800 [thread overview] Message-ID: <a1ac116d3416d13161312a5a08c4d0e9f6218639.1660563403.git.wqu@suse.com> (raw) In-Reply-To: <cover.1660563403.git.wqu@suse.com> 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> --- fs/erofs/internal.h | 1 + fs/erofs/super.c | 6 ++++++ fs/fs.c | 2 +- include/erofs.h | 1 + 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h index 4af7c91560cc..d368a6481bf1 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 8277d9b53fb3..82625da59001 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 43c7128bcfc5..2ac43c05fcd8 100644 --- a/fs/fs.c +++ b/fs/fs.c @@ -376,7 +376,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 1fbe82bf72cb..18bd6807c538 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); -- 2.37.1
next prev parent reply other threads:[~2022-08-15 11:46 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-08-15 11:45 [PATCH v3 0/8] U-boot: fs: add generic unaligned read offset handling Qu Wenruo via Linux-erofs 2022-08-15 11:45 ` Qu Wenruo 2022-08-15 11:45 ` [PATCH v3 1/8] fs: fat: unexport file_fat_read_at() Qu Wenruo 2022-08-15 11:45 ` Qu Wenruo via Linux-erofs 2022-08-15 11:45 ` [PATCH v3 2/8] fs: btrfs: fix a bug which no data get read if the length is not 0 Qu Wenruo 2022-08-15 11:45 ` Qu Wenruo via Linux-erofs 2022-08-15 11:45 ` [PATCH v3 3/8] fs: btrfs: fix a crash if specified range is beyond file size Qu Wenruo 2022-08-15 11:45 ` Qu Wenruo via Linux-erofs 2022-08-15 11:45 ` [PATCH v3 4/8] fs: btrfs: move the unaligned read code to _fs_read() for btrfs Qu Wenruo 2022-08-15 11:45 ` Qu Wenruo via Linux-erofs 2022-08-15 11:45 ` [PATCH v3 5/8] fs: ext4: rely on _fs_read() to handle leading unaligned block read Qu Wenruo 2022-08-15 11:45 ` Qu Wenruo via Linux-erofs 2022-08-15 11:45 ` [PATCH v3 6/8] fs: fat: rely on higher layer to get block aligned read range Qu Wenruo 2022-08-15 11:45 ` Qu Wenruo via Linux-erofs 2022-08-15 11:45 ` [PATCH v3 7/8] fs: ubifs: rely on higher layer to do unaligned read Qu Wenruo 2022-08-15 11:45 ` Qu Wenruo via Linux-erofs 2022-08-15 11:45 ` Qu Wenruo [this message] 2022-08-15 11:45 ` [PATCH v3 8/8] fs: erofs: add unaligned read range handling Qu Wenruo via Linux-erofs 2022-08-26 14:29 ` [PATCH v3 0/8] U-boot: fs: add generic unaligned read offset handling Tom Rini 2022-08-26 14:29 ` Tom Rini
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=a1ac116d3416d13161312a5a08c4d0e9f6218639.1660563403.git.wqu@suse.com \ --to=wqu@suse.com \ --cc=jnhuang95@gmail.com \ --cc=joaomarcos.costa@bootlin.com \ --cc=linux-btrfs@vger.kernel.org \ --cc=linux-erofs@lists.ozlabs.org \ --cc=marek.behun@nic.cz \ --cc=miquel.raynal@bootlin.com \ --cc=thomas.petazzoni@bootlin.com \ --cc=trini@konsulko.com \ --cc=u-boot@lists.denx.de \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.