|
Kmods SIG |
d83023 |
From 27fac77707a1d99deef33fd5f3f5f2ed96bfbf6a Mon Sep 17 00:00:00 2001
|
|
Kmods SIG |
d83023 |
From: Kari Argillander <kari.argillander@gmail.com>
|
|
Kmods SIG |
d83023 |
Date: Tue, 7 Sep 2021 18:35:53 +0300
|
|
Kmods SIG |
d83023 |
Subject: [Backport 27fac77707a1] src: Init spi more in init_fs_context
|
|
Kmods SIG |
d83023 |
than fill_super
|
|
Kmods SIG |
d83023 |
|
|
Kmods SIG |
d83023 |
init_fs_context() is meant to initialize s_fs_info (spi). Move spi
|
|
Kmods SIG |
d83023 |
initializing code there which we can initialize before fill_super().
|
|
Kmods SIG |
d83023 |
|
|
Kmods SIG |
d83023 |
Signed-off-by: Kari Argillander <kari.argillander@gmail.com>
|
|
Kmods SIG |
d83023 |
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
|
|
Kmods SIG |
d83023 |
---
|
|
Kmods SIG |
d83023 |
src/super.c | 41 ++++++++++++++++++++++-------------------
|
|
Kmods SIG |
d83023 |
1 file changed, 22 insertions(+), 19 deletions(-)
|
|
Kmods SIG |
d83023 |
|
|
Kmods SIG |
d83023 |
diff --git a/src/super.c b/src/super.c
|
|
Kmods SIG |
d83023 |
index befa78d3cb26767e401c84cc87a40006c4603186..420cd140917007d9edb3072e19f77c87139f8f20 100644
|
|
Kmods SIG |
d83023 |
--- a/src/super.c
|
|
Kmods SIG |
d83023 |
+++ b/src/super.c
|
|
Kmods SIG |
d83023 |
@@ -887,7 +887,7 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc)
|
|
Kmods SIG |
d83023 |
const struct VOLUME_INFO *info;
|
|
Kmods SIG |
d83023 |
u32 idx, done, bytes;
|
|
Kmods SIG |
d83023 |
struct ATTR_DEF_ENTRY *t;
|
|
Kmods SIG |
d83023 |
- u16 *upcase = NULL;
|
|
Kmods SIG |
d83023 |
+ u16 *upcase;
|
|
Kmods SIG |
d83023 |
u16 *shared;
|
|
Kmods SIG |
d83023 |
bool is_ro;
|
|
Kmods SIG |
d83023 |
struct MFT_REF ref;
|
|
Kmods SIG |
d83023 |
@@ -902,9 +902,6 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc)
|
|
Kmods SIG |
d83023 |
sb->s_time_gran = NTFS_TIME_GRAN; // 100 nsec
|
|
Kmods SIG |
d83023 |
sb->s_xattr = ntfs_xattr_handlers;
|
|
Kmods SIG |
d83023 |
|
|
Kmods SIG |
d83023 |
- ratelimit_state_init(&sbi->msg_ratelimit, DEFAULT_RATELIMIT_INTERVAL,
|
|
Kmods SIG |
d83023 |
- DEFAULT_RATELIMIT_BURST);
|
|
Kmods SIG |
d83023 |
-
|
|
Kmods SIG |
d83023 |
sbi->options->nls = ntfs_load_nls(sbi->options->nls_name);
|
|
Kmods SIG |
d83023 |
if (IS_ERR(sbi->options->nls)) {
|
|
Kmods SIG |
d83023 |
sbi->options->nls = NULL;
|
|
Kmods SIG |
d83023 |
@@ -934,12 +931,6 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc)
|
|
Kmods SIG |
d83023 |
sb->s_maxbytes = 0xFFFFFFFFull << sbi->cluster_bits;
|
|
Kmods SIG |
d83023 |
#endif
|
|
Kmods SIG |
d83023 |
|
|
Kmods SIG |
d83023 |
- mutex_init(&sbi->compress.mtx_lznt);
|
|
Kmods SIG |
d83023 |
-#ifdef CONFIG_NTFS3_LZX_XPRESS
|
|
Kmods SIG |
d83023 |
- mutex_init(&sbi->compress.mtx_xpress);
|
|
Kmods SIG |
d83023 |
- mutex_init(&sbi->compress.mtx_lzx);
|
|
Kmods SIG |
d83023 |
-#endif
|
|
Kmods SIG |
d83023 |
-
|
|
Kmods SIG |
d83023 |
/*
|
|
Kmods SIG |
d83023 |
* Load $Volume. This should be done before $LogFile
|
|
Kmods SIG |
d83023 |
* 'cause 'sbi->volume.ni' is used 'ntfs_set_state'.
|
|
Kmods SIG |
d83023 |
@@ -1224,11 +1215,7 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc)
|
|
Kmods SIG |
d83023 |
goto out;
|
|
Kmods SIG |
d83023 |
}
|
|
Kmods SIG |
d83023 |
|
|
Kmods SIG |
d83023 |
- sbi->upcase = upcase = kvmalloc(0x10000 * sizeof(short), GFP_KERNEL);
|
|
Kmods SIG |
d83023 |
- if (!upcase) {
|
|
Kmods SIG |
d83023 |
- err = -ENOMEM;
|
|
Kmods SIG |
d83023 |
- goto out;
|
|
Kmods SIG |
d83023 |
- }
|
|
Kmods SIG |
d83023 |
+ upcase = sbi->upcase;
|
|
Kmods SIG |
d83023 |
|
|
Kmods SIG |
d83023 |
for (idx = 0; idx < (0x10000 * sizeof(short) >> PAGE_SHIFT); idx++) {
|
|
Kmods SIG |
d83023 |
const __le16 *src;
|
|
Kmods SIG |
d83023 |
@@ -1440,10 +1427,21 @@ static int ntfs_init_fs_context(struct fs_context *fc)
|
|
Kmods SIG |
d83023 |
goto ok;
|
|
Kmods SIG |
d83023 |
|
|
Kmods SIG |
d83023 |
sbi = kzalloc(sizeof(struct ntfs_sb_info), GFP_NOFS);
|
|
Kmods SIG |
d83023 |
- if (!sbi) {
|
|
Kmods SIG |
d83023 |
- kfree(opts);
|
|
Kmods SIG |
d83023 |
- return -ENOMEM;
|
|
Kmods SIG |
d83023 |
- }
|
|
Kmods SIG |
d83023 |
+ if (!sbi)
|
|
Kmods SIG |
d83023 |
+ goto free_opts;
|
|
Kmods SIG |
d83023 |
+
|
|
Kmods SIG |
d83023 |
+ sbi->upcase = kvmalloc(0x10000 * sizeof(short), GFP_KERNEL);
|
|
Kmods SIG |
d83023 |
+ if (!sbi->upcase)
|
|
Kmods SIG |
d83023 |
+ goto free_sbi;
|
|
Kmods SIG |
d83023 |
+
|
|
Kmods SIG |
d83023 |
+ ratelimit_state_init(&sbi->msg_ratelimit, DEFAULT_RATELIMIT_INTERVAL,
|
|
Kmods SIG |
d83023 |
+ DEFAULT_RATELIMIT_BURST);
|
|
Kmods SIG |
d83023 |
+
|
|
Kmods SIG |
d83023 |
+ mutex_init(&sbi->compress.mtx_lznt);
|
|
Kmods SIG |
d83023 |
+#ifdef CONFIG_NTFS3_LZX_XPRESS
|
|
Kmods SIG |
d83023 |
+ mutex_init(&sbi->compress.mtx_xpress);
|
|
Kmods SIG |
d83023 |
+ mutex_init(&sbi->compress.mtx_lzx);
|
|
Kmods SIG |
d83023 |
+#endif
|
|
Kmods SIG |
d83023 |
|
|
Kmods SIG |
d83023 |
sbi->options = opts;
|
|
Kmods SIG |
d83023 |
fc->s_fs_info = sbi;
|
|
Kmods SIG |
d83023 |
@@ -1452,6 +1450,11 @@ static int ntfs_init_fs_context(struct fs_context *fc)
|
|
Kmods SIG |
d83023 |
fc->ops = &ntfs_context_ops;
|
|
Kmods SIG |
d83023 |
|
|
Kmods SIG |
d83023 |
return 0;
|
|
Kmods SIG |
d83023 |
+free_opts:
|
|
Kmods SIG |
d83023 |
+ kfree(opts);
|
|
Kmods SIG |
d83023 |
+free_sbi:
|
|
Kmods SIG |
d83023 |
+ kfree(sbi);
|
|
Kmods SIG |
d83023 |
+ return -ENOMEM;
|
|
Kmods SIG |
d83023 |
}
|
|
Kmods SIG |
d83023 |
|
|
Kmods SIG |
d83023 |
// clang-format off
|
|
Kmods SIG |
d83023 |
--
|
|
Kmods SIG |
d83023 |
2.31.1
|
|
Kmods SIG |
d83023 |
|