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 8/8] fs: erofs: add unaligned read range handling
Date: Wed, 29 Jun 2022 19:38:29 +0800 [thread overview]
Message-ID: <f1f81773bf816717089d2ffde1ce673f5bb25e1e.1656502685.git.wqu@suse.com> (raw)
In-Reply-To: <cover.1656502685.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 4cca322b9ead..df01d2e719a7 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 61bae1051406..e92174d89c28 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 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.36.1
next prev parent reply other threads:[~2022-06-29 11:39 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-29 11:38 [PATCH 0/8] U-boot: fs: add generic unaligned read offset handling Qu Wenruo
2022-06-29 11:38 ` [PATCH 1/8] fs: fat: unexport file_fat_read_at() Qu Wenruo
2022-07-25 22:28 ` Tom Rini
2022-07-26 1:35 ` Qu Wenruo
2022-07-26 2:12 ` Tom Rini
2022-06-29 11:38 ` [PATCH 2/8] fs: btrfs: fix a bug which no data get read if the length is not 0 Qu Wenruo
2022-06-29 11:38 ` [PATCH 3/8] fs: btrfs: fix a crash if specified range is beyond file size Qu Wenruo
2022-06-29 11:38 ` [PATCH 4/8] fs: btrfs: move the unaligned read code to _fs_read() for btrfs Qu Wenruo
2022-06-29 11:38 ` [PATCH 5/8] fs: ext4: rely on _fs_read() to handle leading unaligned block read Qu Wenruo
2022-06-29 11:38 ` [PATCH 6/8] fs: fat: rely on higher layer to get block aligned read range Qu Wenruo
2022-06-29 11:38 ` [PATCH 7/8] fs: ubifs: rely on higher layer to do unaligned read Qu Wenruo
2022-06-29 11:38 ` Qu Wenruo [this message]
2022-06-30 12:21 ` [PATCH 8/8] fs: erofs: add unaligned read range handling Huang Jianan
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=f1f81773bf816717089d2ffde1ce673f5bb25e1e.1656502685.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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).