lkml.org 
[lkml]   [2022]   [Mar]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v6 19/22] erofs: register cookie context for data blobs
Date
Similar to the multi device mode, erofs could be mounted from multiple
blob files (one bootstrap blob file and optional multiple data blob
files). In this case, each device slot contains the path of
corresponding data blob file.

Registers corresponding cookie context for each data blob file.

Signed-off-by: Jeffle Xu <jefflexu@linux.alibaba.com>
---
fs/erofs/internal.h | 1 +
fs/erofs/super.c | 30 ++++++++++++++++++++++--------
2 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h
index 6537ededed51..94a118caf580 100644
--- a/fs/erofs/internal.h
+++ b/fs/erofs/internal.h
@@ -52,6 +52,7 @@ struct erofs_device_info {
struct block_device *bdev;
struct dax_device *dax_dev;
u64 dax_part_off;
+ struct erofs_fscache *blob;

u32 blocks;
u32 mapped_blkaddr;
diff --git a/fs/erofs/super.c b/fs/erofs/super.c
index de5aeda4aea0..9a6f35e0c22b 100644
--- a/fs/erofs/super.c
+++ b/fs/erofs/super.c
@@ -259,15 +259,28 @@ static int erofs_init_devices(struct super_block *sb,
}
dis = ptr + erofs_blkoff(pos);

- bdev = blkdev_get_by_path(dif->path,
- FMODE_READ | FMODE_EXCL,
- sb->s_type);
- if (IS_ERR(bdev)) {
- err = PTR_ERR(bdev);
- break;
+ if (IS_ENABLED(CONFIG_EROFS_FS_ONDEMAND) &&
+ erofs_is_nodev_mode(sb)) {
+ struct erofs_fscache *blob;
+
+ blob = erofs_fscache_get(sb, dif->path, false);
+ if (IS_ERR(blob)) {
+ err = PTR_ERR(blob);
+ break;
+ }
+ dif->blob = blob;
+ } else {
+ bdev = blkdev_get_by_path(dif->path,
+ FMODE_READ | FMODE_EXCL,
+ sb->s_type);
+ if (IS_ERR(bdev)) {
+ err = PTR_ERR(bdev);
+ break;
+ }
+ dif->bdev = bdev;
+ dif->dax_dev = fs_dax_get_by_bdev(bdev, &dif->dax_part_off);
}
- dif->bdev = bdev;
- dif->dax_dev = fs_dax_get_by_bdev(bdev, &dif->dax_part_off);
+
dif->blocks = le32_to_cpu(dis->blocks);
dif->mapped_blkaddr = le32_to_cpu(dis->mapped_blkaddr);
sbi->total_blocks += dif->blocks;
@@ -694,6 +707,7 @@ static int erofs_release_device_info(int id, void *ptr, void *data)
{
struct erofs_device_info *dif = ptr;

+ erofs_fscache_put(dif->blob);
fs_put_dax(dif->dax_dev);
if (dif->bdev)
blkdev_put(dif->bdev, FMODE_READ | FMODE_EXCL);
--
2.27.0
\
 
 \ /
  Last update: 2022-03-25 13:25    [W:0.237 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site