From 371fad72cbd4280b611b2c6a67376b54e40f8dbd Mon Sep 17 00:00:00 2001 From: yuedl1 Date: Sun, 5 Jul 2020 20:18:36 +0800 Subject: [PATCH] exfat:fixed exfat compliling failed on kernel 5.4 fixed exfat compliling failed on kernel 5.4 , due to MS_RDONLY and MS_NODIRATIME flag is just used for mounting, if file system need used SB_*. Change-Id: Icf8bb0595bd2aacefcc3bbf6bc81c48f103af6bf Signed-off-by: yuedl1 Reviewed-on: https://gerrit.mot.com/1773673 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Dongliang Yue Reviewed-by: Huosheng Liao Submit-Approved: Jira Key --- fs/exfat/exfat_core.c | 6 ++++++ fs/exfat/exfat_super.c | 10 ++++++++++ fs/exfat/exfat_super.h | 7 +++++++ 3 files changed, 23 insertions(+) diff --git a/fs/exfat/exfat_core.c b/fs/exfat/exfat_core.c index 07befe78d03c..c8ef936d482f 100644 --- a/fs/exfat/exfat_core.c +++ b/fs/exfat/exfat_core.c @@ -1764,8 +1764,14 @@ void fs_error(struct super_block *sb) if (opts->errors == EXFAT_ERRORS_PANIC) panic("[EXFAT] Filesystem panic from previous error\n"); +#if LINUX_VERSION_CODE <= KERNEL_VERSION(4,19,0) else if ((opts->errors == EXFAT_ERRORS_RO) && !(sb->s_flags & MS_RDONLY)) { sb->s_flags |= MS_RDONLY; +#else + else if ((opts->errors == EXFAT_ERRORS_RO) && !(sb->s_flags & SB_RDONLY)) { + sb->s_flags |= SB_RDONLY; +#endif + if (sbi && !sbi->disable_uevent) schedule_work(&sbi->uevent_work); printk(KERN_ERR "[EXFAT] Filesystem has been set read-only\n"); diff --git a/fs/exfat/exfat_super.c b/fs/exfat/exfat_super.c index 5a3b0826b975..2d584a860744 100644 --- a/fs/exfat/exfat_super.c +++ b/fs/exfat/exfat_super.c @@ -2160,7 +2160,12 @@ static int exfat_statfs(struct dentry *dentry, struct kstatfs *buf) static int exfat_remount(struct super_block *sb, int *flags, char *data) { +#if LINUX_VERSION_CODE <= KERNEL_VERSION(4,19,0) *flags |= MS_NODIRATIME; +#else + *flags |= SB_NODIRATIME; +#endif + return 0; } @@ -2516,7 +2521,12 @@ static int exfat_fill_super(struct super_block *sb, void *data, int silent) INIT_WORK(&sbi->uevent_work, exfat_sbi_uevent_work); sb->s_fs_info = sbi; +#if LINUX_VERSION_CODE <= KERNEL_VERSION(4,19,0) sb->s_flags |= MS_NODIRATIME; +#else + sb->s_flags |= SB_NODIRATIME; +#endif + sb->s_magic = EXFAT_SUPER_MAGIC; sb->s_op = &exfat_sops; sb->s_export_op = &exfat_export_ops; diff --git a/fs/exfat/exfat_super.h b/fs/exfat/exfat_super.h index def8cc3e3e8c..8a9f1a86f89a 100644 --- a/fs/exfat/exfat_super.h +++ b/fs/exfat/exfat_super.h @@ -126,7 +126,14 @@ static inline struct exfat_inode_info *EXFAT_I(struct inode *inode) static inline bool exfat_readonly(struct super_block *sb) { +#if LINUX_VERSION_CODE <= KERNEL_VERSION(4,19,0) return sb->s_flags & MS_RDONLY; +#else + return sb->s_flags & SB_RDONLY; +#endif + + + } /*