forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A new fscache based mode is going to be introduced for erofs, in which case on-demand read semantics is implemented through fscache. As the first step, register fscache volume for each erofs filesystem. That means, data blobs can not be shared among erofs filesystems. In the following iteration, we are going to introduce the domain semantics, in which case several erofs filesystems can belong to one domain, and data blobs can be shared among these erofs filesystems of one domain. Signed-off-by: Jeffle Xu <[email protected]> Reviewed-by: Gao Xiang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Acked-by: Chao Yu <[email protected]> Signed-off-by: Gao Xiang <[email protected]>
- Loading branch information
1 parent
93b856b
commit c6be2bd
Showing
5 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
/* | ||
* Copyright (C) 2022, Alibaba Cloud | ||
*/ | ||
#include <linux/fscache.h> | ||
#include "internal.h" | ||
|
||
int erofs_fscache_register_fs(struct super_block *sb) | ||
{ | ||
struct erofs_sb_info *sbi = EROFS_SB(sb); | ||
struct fscache_volume *volume; | ||
char *name; | ||
int ret = 0; | ||
|
||
name = kasprintf(GFP_KERNEL, "erofs,%s", sbi->opt.fsid); | ||
if (!name) | ||
return -ENOMEM; | ||
|
||
volume = fscache_acquire_volume(name, NULL, NULL, 0); | ||
if (IS_ERR_OR_NULL(volume)) { | ||
erofs_err(sb, "failed to register volume for %s", name); | ||
ret = volume ? PTR_ERR(volume) : -EOPNOTSUPP; | ||
volume = NULL; | ||
} | ||
|
||
sbi->volume = volume; | ||
kfree(name); | ||
return ret; | ||
} | ||
|
||
void erofs_fscache_unregister_fs(struct super_block *sb) | ||
{ | ||
struct erofs_sb_info *sbi = EROFS_SB(sb); | ||
|
||
fscache_relinquish_volume(sbi->volume, NULL, false); | ||
sbi->volume = NULL; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters