|
Kmods SIG |
9e3ffb |
From 7018ec68f08249de17cb131b324d5a48e89ed898 Mon Sep 17 00:00:00 2001
|
|
Kmods SIG |
9e3ffb |
From: Tetsuhiro Kohada <kohada.t2@gmail.com>
|
|
Kmods SIG |
9e3ffb |
Date: Fri, 31 Jul 2020 14:58:26 +0900
|
|
Kmods SIG |
9e3ffb |
Subject: [Backport 7018ec68f082] exfat: retain 'VolumeFlags' properly
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
MediaFailure and VolumeDirty should be retained if these are set before
|
|
Kmods SIG |
9e3ffb |
mounting.
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
In '3.1.13.3 Media Failure Field' of exfat specification describe:
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
If, upon mounting a volume, the value of this field is 1,
|
|
Kmods SIG |
9e3ffb |
implementations which scan the entire volume for media failures and
|
|
Kmods SIG |
9e3ffb |
record all failures as "bad" clusters in the FAT (or otherwise resolve
|
|
Kmods SIG |
9e3ffb |
media failures) may clear the value of this field to 0.
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
Therefore, We should not clear MediaFailure without scanning volume.
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
In '8.1 Recommended Write Ordering' of exfat specification describe:
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
Clear the value of the VolumeDirty field to 0, if its value prior to
|
|
Kmods SIG |
9e3ffb |
the first step was 0.
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
Therefore, We should not clear VolumeDirty after mounting.
|
|
Kmods SIG |
9e3ffb |
Also rename ERR_MEDIUM to MEDIA_FAILURE.
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
Signed-off-by: Tetsuhiro Kohada <kohada.t2@gmail.com>
|
|
Kmods SIG |
9e3ffb |
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
|
|
Kmods SIG |
9e3ffb |
---
|
|
Kmods SIG |
9e3ffb |
src/exfat_fs.h | 6 ++++--
|
|
Kmods SIG |
9e3ffb |
src/exfat_raw.h | 5 ++---
|
|
Kmods SIG |
9e3ffb |
src/file.c | 4 ++--
|
|
Kmods SIG |
9e3ffb |
src/inode.c | 4 ++--
|
|
Kmods SIG |
9e3ffb |
src/namei.c | 20 ++++++++++----------
|
|
Kmods SIG |
9e3ffb |
src/super.c | 36 +++++++++++++++++++++++++++---------
|
|
Kmods SIG |
9e3ffb |
6 files changed, 47 insertions(+), 28 deletions(-)
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
diff --git a/src/exfat_fs.h b/src/exfat_fs.h
|
|
Kmods SIG |
9e3ffb |
index cb51d6e831990f13413267f4fa0a04c3a6176380..95d717f8620cd06cd29909ca07a17208dfd12325 100644
|
|
Kmods SIG |
9e3ffb |
--- a/src/exfat_fs.h
|
|
Kmods SIG |
9e3ffb |
+++ b/src/exfat_fs.h
|
|
Kmods SIG |
9e3ffb |
@@ -224,7 +224,8 @@ struct exfat_sb_info {
|
|
Kmods SIG |
9e3ffb |
unsigned int num_FAT_sectors; /* num of FAT sectors */
|
|
Kmods SIG |
9e3ffb |
unsigned int root_dir; /* root dir cluster */
|
|
Kmods SIG |
9e3ffb |
unsigned int dentries_per_clu; /* num of dentries per cluster */
|
|
Kmods SIG |
9e3ffb |
- unsigned int vol_flag; /* volume dirty flag */
|
|
Kmods SIG |
9e3ffb |
+ unsigned int vol_flags; /* volume flags */
|
|
Kmods SIG |
9e3ffb |
+ unsigned int vol_flags_persistent; /* volume flags to retain */
|
|
Kmods SIG |
9e3ffb |
struct buffer_head *boot_bh; /* buffer_head of BOOT sector */
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
unsigned int map_clu; /* allocation bitmap start cluster */
|
|
Kmods SIG |
9e3ffb |
@@ -380,7 +381,8 @@ static inline int exfat_sector_to_cluster(struct exfat_sb_info *sbi,
|
|
Kmods SIG |
9e3ffb |
}
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
/* super.c */
|
|
Kmods SIG |
9e3ffb |
-int exfat_set_vol_flags(struct super_block *sb, unsigned short new_flag);
|
|
Kmods SIG |
9e3ffb |
+int exfat_set_volume_dirty(struct super_block *sb);
|
|
Kmods SIG |
9e3ffb |
+int exfat_clear_volume_dirty(struct super_block *sb);
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
/* fatent.c */
|
|
Kmods SIG |
9e3ffb |
#define exfat_get_next_cluster(sb, pclu) exfat_ent_get(sb, *(pclu), pclu)
|
|
Kmods SIG |
9e3ffb |
diff --git a/src/exfat_raw.h b/src/exfat_raw.h
|
|
Kmods SIG |
9e3ffb |
index 350ce59cc32478919d9ffb9823726b8b9015de48..6aec6288e1f21981920f802083d591034c3fb6a2 100644
|
|
Kmods SIG |
9e3ffb |
--- a/src/exfat_raw.h
|
|
Kmods SIG |
9e3ffb |
+++ b/src/exfat_raw.h
|
|
Kmods SIG |
9e3ffb |
@@ -14,9 +14,8 @@
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
#define EXFAT_MAX_FILE_LEN 255
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
-#define VOL_CLEAN 0x0000
|
|
Kmods SIG |
9e3ffb |
-#define VOL_DIRTY 0x0002
|
|
Kmods SIG |
9e3ffb |
-#define ERR_MEDIUM 0x0004
|
|
Kmods SIG |
9e3ffb |
+#define VOLUME_DIRTY 0x0002
|
|
Kmods SIG |
9e3ffb |
+#define MEDIA_FAILURE 0x0004
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
#define EXFAT_EOF_CLUSTER 0xFFFFFFFFu
|
|
Kmods SIG |
9e3ffb |
#define EXFAT_BAD_CLUSTER 0xFFFFFFF7u
|
|
Kmods SIG |
9e3ffb |
diff --git a/src/file.c b/src/file.c
|
|
Kmods SIG |
9e3ffb |
index 6bdabfd4b13426a1965a0e90598a3f5a2821bbe9..f41f523a58ad4dab6f7c4d3edef6efce21348ce5 100644
|
|
Kmods SIG |
9e3ffb |
--- a/src/file.c
|
|
Kmods SIG |
9e3ffb |
+++ b/src/file.c
|
|
Kmods SIG |
9e3ffb |
@@ -106,7 +106,7 @@ int __exfat_truncate(struct inode *inode, loff_t new_size)
|
|
Kmods SIG |
9e3ffb |
if (ei->type != TYPE_FILE && ei->type != TYPE_DIR)
|
|
Kmods SIG |
9e3ffb |
return -EPERM;
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
- exfat_set_vol_flags(sb, VOL_DIRTY);
|
|
Kmods SIG |
9e3ffb |
+ exfat_set_volume_dirty(sb);
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
num_clusters_new = EXFAT_B_TO_CLU_ROUND_UP(i_size_read(inode), sbi);
|
|
Kmods SIG |
9e3ffb |
num_clusters_phys =
|
|
Kmods SIG |
9e3ffb |
@@ -220,7 +220,7 @@ int __exfat_truncate(struct inode *inode, loff_t new_size)
|
|
Kmods SIG |
9e3ffb |
if (exfat_free_cluster(inode, &clu))
|
|
Kmods SIG |
9e3ffb |
return -EIO;
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
- exfat_set_vol_flags(sb, VOL_CLEAN);
|
|
Kmods SIG |
9e3ffb |
+ exfat_clear_volume_dirty(sb);
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
return 0;
|
|
Kmods SIG |
9e3ffb |
}
|
|
Kmods SIG |
9e3ffb |
diff --git a/src/inode.c b/src/inode.c
|
|
Kmods SIG |
9e3ffb |
index f0160a7892a815cf22a0e495db104a9ebea35615..7f90204adef53027dd1eb4348141394af5548b1b 100644
|
|
Kmods SIG |
9e3ffb |
--- a/src/inode.c
|
|
Kmods SIG |
9e3ffb |
+++ b/src/inode.c
|
|
Kmods SIG |
9e3ffb |
@@ -39,7 +39,7 @@ static int __exfat_write_inode(struct inode *inode, int sync)
|
|
Kmods SIG |
9e3ffb |
if (is_dir && ei->dir.dir == sbi->root_dir && ei->entry == -1)
|
|
Kmods SIG |
9e3ffb |
return 0;
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
- exfat_set_vol_flags(sb, VOL_DIRTY);
|
|
Kmods SIG |
9e3ffb |
+ exfat_set_volume_dirty(sb);
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
/* get the directory entry of given file or directory */
|
|
Kmods SIG |
9e3ffb |
es = exfat_get_dentry_set(sb, &(ei->dir), ei->entry, ES_ALL_ENTRIES);
|
|
Kmods SIG |
9e3ffb |
@@ -167,7 +167,7 @@ static int exfat_map_cluster(struct inode *inode, unsigned int clu_offset,
|
|
Kmods SIG |
9e3ffb |
}
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
if (*clu == EXFAT_EOF_CLUSTER) {
|
|
Kmods SIG |
9e3ffb |
- exfat_set_vol_flags(sb, VOL_DIRTY);
|
|
Kmods SIG |
9e3ffb |
+ exfat_set_volume_dirty(sb);
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
new_clu.dir = (last_clu == EXFAT_EOF_CLUSTER) ?
|
|
Kmods SIG |
9e3ffb |
EXFAT_EOF_CLUSTER : last_clu + 1;
|
|
Kmods SIG |
9e3ffb |
diff --git a/src/namei.c b/src/namei.c
|
|
Kmods SIG |
9e3ffb |
index 126ed3ba8f4791859a11bdfac05a1b71847b2e22..e73f20f66cb2e1c1c3c20b4a62bad8210fda6e8b 100644
|
|
Kmods SIG |
9e3ffb |
--- a/src/namei.c
|
|
Kmods SIG |
9e3ffb |
+++ b/src/namei.c
|
|
Kmods SIG |
9e3ffb |
@@ -562,10 +562,10 @@ static int exfat_create(struct inode *dir, struct dentry *dentry, umode_t mode,
|
|
Kmods SIG |
9e3ffb |
int err;
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
mutex_lock(&EXFAT_SB(sb)->s_lock);
|
|
Kmods SIG |
9e3ffb |
- exfat_set_vol_flags(sb, VOL_DIRTY);
|
|
Kmods SIG |
9e3ffb |
+ exfat_set_volume_dirty(sb);
|
|
Kmods SIG |
9e3ffb |
err = exfat_add_entry(dir, dentry->d_name.name, &cdir, TYPE_FILE,
|
|
Kmods SIG |
9e3ffb |
&info;;
|
|
Kmods SIG |
9e3ffb |
- exfat_set_vol_flags(sb, VOL_CLEAN);
|
|
Kmods SIG |
9e3ffb |
+ exfat_clear_volume_dirty(sb);
|
|
Kmods SIG |
9e3ffb |
if (err)
|
|
Kmods SIG |
9e3ffb |
goto unlock;
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
@@ -834,7 +834,7 @@ static int exfat_unlink(struct inode *dir, struct dentry *dentry)
|
|
Kmods SIG |
9e3ffb |
num_entries++;
|
|
Kmods SIG |
9e3ffb |
brelse(bh);
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
- exfat_set_vol_flags(sb, VOL_DIRTY);
|
|
Kmods SIG |
9e3ffb |
+ exfat_set_volume_dirty(sb);
|
|
Kmods SIG |
9e3ffb |
/* update the directory entry */
|
|
Kmods SIG |
9e3ffb |
if (exfat_remove_entries(dir, &cdir, entry, 0, num_entries)) {
|
|
Kmods SIG |
9e3ffb |
err = -EIO;
|
|
Kmods SIG |
9e3ffb |
@@ -843,7 +843,7 @@ static int exfat_unlink(struct inode *dir, struct dentry *dentry)
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
/* This doesn't modify ei */
|
|
Kmods SIG |
9e3ffb |
ei->dir.dir = DIR_DELETED;
|
|
Kmods SIG |
9e3ffb |
- exfat_set_vol_flags(sb, VOL_CLEAN);
|
|
Kmods SIG |
9e3ffb |
+ exfat_clear_volume_dirty(sb);
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
inode_inc_iversion(dir);
|
|
Kmods SIG |
9e3ffb |
dir->i_mtime = dir->i_atime = current_time(dir);
|
|
Kmods SIG |
9e3ffb |
@@ -873,10 +873,10 @@ static int exfat_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
|
|
Kmods SIG |
9e3ffb |
int err;
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
mutex_lock(&EXFAT_SB(sb)->s_lock);
|
|
Kmods SIG |
9e3ffb |
- exfat_set_vol_flags(sb, VOL_DIRTY);
|
|
Kmods SIG |
9e3ffb |
+ exfat_set_volume_dirty(sb);
|
|
Kmods SIG |
9e3ffb |
err = exfat_add_entry(dir, dentry->d_name.name, &cdir, TYPE_DIR,
|
|
Kmods SIG |
9e3ffb |
&info;;
|
|
Kmods SIG |
9e3ffb |
- exfat_set_vol_flags(sb, VOL_CLEAN);
|
|
Kmods SIG |
9e3ffb |
+ exfat_clear_volume_dirty(sb);
|
|
Kmods SIG |
9e3ffb |
if (err)
|
|
Kmods SIG |
9e3ffb |
goto unlock;
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
@@ -1001,14 +1001,14 @@ static int exfat_rmdir(struct inode *dir, struct dentry *dentry)
|
|
Kmods SIG |
9e3ffb |
num_entries++;
|
|
Kmods SIG |
9e3ffb |
brelse(bh);
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
- exfat_set_vol_flags(sb, VOL_DIRTY);
|
|
Kmods SIG |
9e3ffb |
+ exfat_set_volume_dirty(sb);
|
|
Kmods SIG |
9e3ffb |
err = exfat_remove_entries(dir, &cdir, entry, 0, num_entries);
|
|
Kmods SIG |
9e3ffb |
if (err) {
|
|
Kmods SIG |
9e3ffb |
exfat_err(sb, "failed to exfat_remove_entries : err(%d)", err);
|
|
Kmods SIG |
9e3ffb |
goto unlock;
|
|
Kmods SIG |
9e3ffb |
}
|
|
Kmods SIG |
9e3ffb |
ei->dir.dir = DIR_DELETED;
|
|
Kmods SIG |
9e3ffb |
- exfat_set_vol_flags(sb, VOL_CLEAN);
|
|
Kmods SIG |
9e3ffb |
+ exfat_clear_volume_dirty(sb);
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
inode_inc_iversion(dir);
|
|
Kmods SIG |
9e3ffb |
dir->i_mtime = dir->i_atime = current_time(dir);
|
|
Kmods SIG |
9e3ffb |
@@ -1300,7 +1300,7 @@ static int __exfat_rename(struct inode *old_parent_inode,
|
|
Kmods SIG |
9e3ffb |
if (ret)
|
|
Kmods SIG |
9e3ffb |
goto out;
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
- exfat_set_vol_flags(sb, VOL_DIRTY);
|
|
Kmods SIG |
9e3ffb |
+ exfat_set_volume_dirty(sb);
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
if (olddir.dir == newdir.dir)
|
|
Kmods SIG |
9e3ffb |
ret = exfat_rename_file(new_parent_inode, &olddir, dentry,
|
|
Kmods SIG |
9e3ffb |
@@ -1355,7 +1355,7 @@ static int __exfat_rename(struct inode *old_parent_inode,
|
|
Kmods SIG |
9e3ffb |
*/
|
|
Kmods SIG |
9e3ffb |
new_ei->dir.dir = DIR_DELETED;
|
|
Kmods SIG |
9e3ffb |
}
|
|
Kmods SIG |
9e3ffb |
- exfat_set_vol_flags(sb, VOL_CLEAN);
|
|
Kmods SIG |
9e3ffb |
+ exfat_clear_volume_dirty(sb);
|
|
Kmods SIG |
9e3ffb |
out:
|
|
Kmods SIG |
9e3ffb |
return ret;
|
|
Kmods SIG |
9e3ffb |
}
|
|
Kmods SIG |
9e3ffb |
diff --git a/src/super.c b/src/super.c
|
|
Kmods SIG |
9e3ffb |
index b5bf6dedbe1159fb4aa0b501ab7e5b8f2051a063..3b6a1659892ffd6ee3a94f6aa0f8bfca65fba9ae 100644
|
|
Kmods SIG |
9e3ffb |
--- a/src/super.c
|
|
Kmods SIG |
9e3ffb |
+++ b/src/super.c
|
|
Kmods SIG |
9e3ffb |
@@ -63,7 +63,7 @@ static int exfat_sync_fs(struct super_block *sb, int wait)
|
|
Kmods SIG |
9e3ffb |
/* If there are some dirty buffers in the bdev inode */
|
|
Kmods SIG |
9e3ffb |
mutex_lock(&sbi->s_lock);
|
|
Kmods SIG |
9e3ffb |
sync_blockdev(sb->s_bdev);
|
|
Kmods SIG |
9e3ffb |
- if (exfat_set_vol_flags(sb, VOL_CLEAN))
|
|
Kmods SIG |
9e3ffb |
+ if (exfat_clear_volume_dirty(sb))
|
|
Kmods SIG |
9e3ffb |
err = -EIO;
|
|
Kmods SIG |
9e3ffb |
mutex_unlock(&sbi->s_lock);
|
|
Kmods SIG |
9e3ffb |
return err;
|
|
Kmods SIG |
9e3ffb |
@@ -96,17 +96,20 @@ static int exfat_statfs(struct dentry *dentry, struct kstatfs *buf)
|
|
Kmods SIG |
9e3ffb |
return 0;
|
|
Kmods SIG |
9e3ffb |
}
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
-int exfat_set_vol_flags(struct super_block *sb, unsigned short new_flag)
|
|
Kmods SIG |
9e3ffb |
+static int exfat_set_vol_flags(struct super_block *sb, unsigned short new_flags)
|
|
Kmods SIG |
9e3ffb |
{
|
|
Kmods SIG |
9e3ffb |
struct exfat_sb_info *sbi = EXFAT_SB(sb);
|
|
Kmods SIG |
9e3ffb |
struct boot_sector *p_boot = (struct boot_sector *)sbi->boot_bh->b_data;
|
|
Kmods SIG |
9e3ffb |
bool sync;
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
+ /* retain persistent-flags */
|
|
Kmods SIG |
9e3ffb |
+ new_flags |= sbi->vol_flags_persistent;
|
|
Kmods SIG |
9e3ffb |
+
|
|
Kmods SIG |
9e3ffb |
/* flags are not changed */
|
|
Kmods SIG |
9e3ffb |
- if (sbi->vol_flag == new_flag)
|
|
Kmods SIG |
9e3ffb |
+ if (sbi->vol_flags == new_flags)
|
|
Kmods SIG |
9e3ffb |
return 0;
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
- sbi->vol_flag = new_flag;
|
|
Kmods SIG |
9e3ffb |
+ sbi->vol_flags = new_flags;
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
/* skip updating volume dirty flag,
|
|
Kmods SIG |
9e3ffb |
* if this volume has been mounted with read-only
|
|
Kmods SIG |
9e3ffb |
@@ -114,9 +117,9 @@ int exfat_set_vol_flags(struct super_block *sb, unsigned short new_flag)
|
|
Kmods SIG |
9e3ffb |
if (sb_rdonly(sb))
|
|
Kmods SIG |
9e3ffb |
return 0;
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
- p_boot->vol_flags = cpu_to_le16(new_flag);
|
|
Kmods SIG |
9e3ffb |
+ p_boot->vol_flags = cpu_to_le16(new_flags);
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
- if (new_flag == VOL_DIRTY && !buffer_dirty(sbi->boot_bh))
|
|
Kmods SIG |
9e3ffb |
+ if ((new_flags & VOLUME_DIRTY) && !buffer_dirty(sbi->boot_bh))
|
|
Kmods SIG |
9e3ffb |
sync = true;
|
|
Kmods SIG |
9e3ffb |
else
|
|
Kmods SIG |
9e3ffb |
sync = false;
|
|
Kmods SIG |
9e3ffb |
@@ -129,6 +132,20 @@ int exfat_set_vol_flags(struct super_block *sb, unsigned short new_flag)
|
|
Kmods SIG |
9e3ffb |
return 0;
|
|
Kmods SIG |
9e3ffb |
}
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
+int exfat_set_volume_dirty(struct super_block *sb)
|
|
Kmods SIG |
9e3ffb |
+{
|
|
Kmods SIG |
9e3ffb |
+ struct exfat_sb_info *sbi = EXFAT_SB(sb);
|
|
Kmods SIG |
9e3ffb |
+
|
|
Kmods SIG |
9e3ffb |
+ return exfat_set_vol_flags(sb, sbi->vol_flags | VOLUME_DIRTY);
|
|
Kmods SIG |
9e3ffb |
+}
|
|
Kmods SIG |
9e3ffb |
+
|
|
Kmods SIG |
9e3ffb |
+int exfat_clear_volume_dirty(struct super_block *sb)
|
|
Kmods SIG |
9e3ffb |
+{
|
|
Kmods SIG |
9e3ffb |
+ struct exfat_sb_info *sbi = EXFAT_SB(sb);
|
|
Kmods SIG |
9e3ffb |
+
|
|
Kmods SIG |
9e3ffb |
+ return exfat_set_vol_flags(sb, sbi->vol_flags & ~VOLUME_DIRTY);
|
|
Kmods SIG |
9e3ffb |
+}
|
|
Kmods SIG |
9e3ffb |
+
|
|
Kmods SIG |
9e3ffb |
static int exfat_show_options(struct seq_file *m, struct dentry *root)
|
|
Kmods SIG |
9e3ffb |
{
|
|
Kmods SIG |
9e3ffb |
struct super_block *sb = root->d_sb;
|
|
Kmods SIG |
9e3ffb |
@@ -457,7 +474,8 @@ static int exfat_read_boot_sector(struct super_block *sb)
|
|
Kmods SIG |
9e3ffb |
sbi->dentries_per_clu = 1 <<
|
|
Kmods SIG |
9e3ffb |
(sbi->cluster_size_bits - DENTRY_SIZE_BITS);
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
- sbi->vol_flag = le16_to_cpu(p_boot->vol_flags);
|
|
Kmods SIG |
9e3ffb |
+ sbi->vol_flags = le16_to_cpu(p_boot->vol_flags);
|
|
Kmods SIG |
9e3ffb |
+ sbi->vol_flags_persistent = sbi->vol_flags & (VOLUME_DIRTY | MEDIA_FAILURE);
|
|
Kmods SIG |
9e3ffb |
sbi->clu_srch_ptr = EXFAT_FIRST_CLUSTER;
|
|
Kmods SIG |
9e3ffb |
sbi->used_clusters = EXFAT_CLUSTERS_UNTRACKED;
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
@@ -472,9 +490,9 @@ static int exfat_read_boot_sector(struct super_block *sb)
|
|
Kmods SIG |
9e3ffb |
exfat_err(sb, "bogus data start sector");
|
|
Kmods SIG |
9e3ffb |
return -EINVAL;
|
|
Kmods SIG |
9e3ffb |
}
|
|
Kmods SIG |
9e3ffb |
- if (sbi->vol_flag & VOL_DIRTY)
|
|
Kmods SIG |
9e3ffb |
+ if (sbi->vol_flags & VOLUME_DIRTY)
|
|
Kmods SIG |
9e3ffb |
exfat_warn(sb, "Volume was not properly unmounted. Some data may be corrupt. Please run fsck.");
|
|
Kmods SIG |
9e3ffb |
- if (sbi->vol_flag & ERR_MEDIUM)
|
|
Kmods SIG |
9e3ffb |
+ if (sbi->vol_flags & MEDIA_FAILURE)
|
|
Kmods SIG |
9e3ffb |
exfat_warn(sb, "Medium has reported failures. Some data may be lost.");
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
/* exFAT file size is limited by a disk volume size */
|
|
Kmods SIG |
9e3ffb |
--
|
|
Kmods SIG |
9e3ffb |
2.31.1
|
|
Kmods SIG |
9e3ffb |
|