|
Kmods SIG |
9e3ffb |
From 23befe490ba885bdf757d40b2489134315fef690 Mon Sep 17 00:00:00 2001
|
|
Kmods SIG |
9e3ffb |
From: Hyeongseok Kim <hyeongseok@gmail.com>
|
|
Kmods SIG |
9e3ffb |
Date: Mon, 15 Mar 2021 13:12:55 +0900
|
|
Kmods SIG |
9e3ffb |
Subject: [Backport 23befe490ba8] exfat: improve write performance when dirsync
|
|
Kmods SIG |
9e3ffb |
enabled
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
Degradation of write speed caused by frequent disk access for cluster
|
|
Kmods SIG |
9e3ffb |
bitmap update on every cluster allocation could be improved by
|
|
Kmods SIG |
9e3ffb |
selective syncing bitmap buffer. Change to flush bitmap buffer only
|
|
Kmods SIG |
9e3ffb |
for the directory related operations.
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
Signed-off-by: Hyeongseok Kim <hyeongseok@gmail.com>
|
|
Kmods SIG |
9e3ffb |
Acked-by: Sungjong Seo <sj1557.seo@samsung.com>
|
|
Kmods SIG |
9e3ffb |
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
|
|
Kmods SIG |
9e3ffb |
---
|
|
Kmods SIG |
9e3ffb |
src/balloc.c | 4 ++--
|
|
Kmods SIG |
9e3ffb |
src/dir.c | 2 +-
|
|
Kmods SIG |
9e3ffb |
src/exfat_fs.h | 4 ++--
|
|
Kmods SIG |
9e3ffb |
src/fatent.c | 4 ++--
|
|
Kmods SIG |
9e3ffb |
src/inode.c | 3 ++-
|
|
Kmods SIG |
9e3ffb |
src/namei.c | 2 +-
|
|
Kmods SIG |
9e3ffb |
6 files changed, 10 insertions(+), 9 deletions(-)
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
diff --git a/src/balloc.c b/src/balloc.c
|
|
Kmods SIG |
9e3ffb |
index 78bc87d5a11bf9688dbef42ad9c3b4f0c232c0f1..cc5cffc4a76910cb2ed3c36f1fcadd4ccb9b1679 100644
|
|
Kmods SIG |
9e3ffb |
--- a/src/balloc.c
|
|
Kmods SIG |
9e3ffb |
+++ b/src/balloc.c
|
|
Kmods SIG |
9e3ffb |
@@ -141,7 +141,7 @@ void exfat_free_bitmap(struct exfat_sb_info *sbi)
|
|
Kmods SIG |
9e3ffb |
kfree(sbi->vol_amap);
|
|
Kmods SIG |
9e3ffb |
}
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
-int exfat_set_bitmap(struct inode *inode, unsigned int clu)
|
|
Kmods SIG |
9e3ffb |
+int exfat_set_bitmap(struct inode *inode, unsigned int clu, bool sync)
|
|
Kmods SIG |
9e3ffb |
{
|
|
Kmods SIG |
9e3ffb |
int i, b;
|
|
Kmods SIG |
9e3ffb |
unsigned int ent_idx;
|
|
Kmods SIG |
9e3ffb |
@@ -154,7 +154,7 @@ int exfat_set_bitmap(struct inode *inode, unsigned int clu)
|
|
Kmods SIG |
9e3ffb |
b = BITMAP_OFFSET_BIT_IN_SECTOR(sb, ent_idx);
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
set_bit_le(b, sbi->vol_amap[i]->b_data);
|
|
Kmods SIG |
9e3ffb |
- exfat_update_bh(sbi->vol_amap[i], IS_DIRSYNC(inode));
|
|
Kmods SIG |
9e3ffb |
+ exfat_update_bh(sbi->vol_amap[i], sync);
|
|
Kmods SIG |
9e3ffb |
return 0;
|
|
Kmods SIG |
9e3ffb |
}
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
diff --git a/src/dir.c b/src/dir.c
|
|
Kmods SIG |
9e3ffb |
index e1d5536de948b3dcd4667cf3074b51462ddb0697..7efb1c6d480846937da5436277b6220dd26f2f7c 100644
|
|
Kmods SIG |
9e3ffb |
--- a/src/dir.c
|
|
Kmods SIG |
9e3ffb |
+++ b/src/dir.c
|
|
Kmods SIG |
9e3ffb |
@@ -320,7 +320,7 @@ int exfat_alloc_new_dir(struct inode *inode, struct exfat_chain *clu)
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
exfat_chain_set(clu, EXFAT_EOF_CLUSTER, 0, ALLOC_NO_FAT_CHAIN);
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
- ret = exfat_alloc_cluster(inode, 1, clu);
|
|
Kmods SIG |
9e3ffb |
+ ret = exfat_alloc_cluster(inode, 1, clu, IS_DIRSYNC(inode));
|
|
Kmods SIG |
9e3ffb |
if (ret)
|
|
Kmods SIG |
9e3ffb |
return ret;
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
diff --git a/src/exfat_fs.h b/src/exfat_fs.h
|
|
Kmods SIG |
9e3ffb |
index 169d0b602f5e7c06c8889b38d83abcfad2e8382c..e77fe2f45cf28fe8533276426a73c657446863f6 100644
|
|
Kmods SIG |
9e3ffb |
--- a/src/exfat_fs.h
|
|
Kmods SIG |
9e3ffb |
+++ b/src/exfat_fs.h
|
|
Kmods SIG |
9e3ffb |
@@ -389,7 +389,7 @@ int exfat_clear_volume_dirty(struct super_block *sb);
|
|
Kmods SIG |
9e3ffb |
#define exfat_get_next_cluster(sb, pclu) exfat_ent_get(sb, *(pclu), pclu)
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
int exfat_alloc_cluster(struct inode *inode, unsigned int num_alloc,
|
|
Kmods SIG |
9e3ffb |
- struct exfat_chain *p_chain);
|
|
Kmods SIG |
9e3ffb |
+ struct exfat_chain *p_chain, bool sync_bmap);
|
|
Kmods SIG |
9e3ffb |
int exfat_free_cluster(struct inode *inode, struct exfat_chain *p_chain);
|
|
Kmods SIG |
9e3ffb |
int exfat_ent_get(struct super_block *sb, unsigned int loc,
|
|
Kmods SIG |
9e3ffb |
unsigned int *content);
|
|
Kmods SIG |
9e3ffb |
@@ -408,7 +408,7 @@ int exfat_count_num_clusters(struct super_block *sb,
|
|
Kmods SIG |
9e3ffb |
/* balloc.c */
|
|
Kmods SIG |
9e3ffb |
int exfat_load_bitmap(struct super_block *sb);
|
|
Kmods SIG |
9e3ffb |
void exfat_free_bitmap(struct exfat_sb_info *sbi);
|
|
Kmods SIG |
9e3ffb |
-int exfat_set_bitmap(struct inode *inode, unsigned int clu);
|
|
Kmods SIG |
9e3ffb |
+int exfat_set_bitmap(struct inode *inode, unsigned int clu, bool sync);
|
|
Kmods SIG |
9e3ffb |
void exfat_clear_bitmap(struct inode *inode, unsigned int clu, bool sync);
|
|
Kmods SIG |
9e3ffb |
unsigned int exfat_find_free_bitmap(struct super_block *sb, unsigned int clu);
|
|
Kmods SIG |
9e3ffb |
int exfat_count_used_clusters(struct super_block *sb, unsigned int *ret_count);
|
|
Kmods SIG |
9e3ffb |
diff --git a/src/fatent.c b/src/fatent.c
|
|
Kmods SIG |
9e3ffb |
index fd6c7fd127620fc405cff2b5ae2d6fae5be25422..e949e563443c937bc80b13b6cd502a0e0a32c68d 100644
|
|
Kmods SIG |
9e3ffb |
--- a/src/fatent.c
|
|
Kmods SIG |
9e3ffb |
+++ b/src/fatent.c
|
|
Kmods SIG |
9e3ffb |
@@ -320,7 +320,7 @@ int exfat_zeroed_cluster(struct inode *dir, unsigned int clu)
|
|
Kmods SIG |
9e3ffb |
}
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
int exfat_alloc_cluster(struct inode *inode, unsigned int num_alloc,
|
|
Kmods SIG |
9e3ffb |
- struct exfat_chain *p_chain)
|
|
Kmods SIG |
9e3ffb |
+ struct exfat_chain *p_chain, bool sync_bmap)
|
|
Kmods SIG |
9e3ffb |
{
|
|
Kmods SIG |
9e3ffb |
int ret = -ENOSPC;
|
|
Kmods SIG |
9e3ffb |
unsigned int num_clusters = 0, total_cnt;
|
|
Kmods SIG |
9e3ffb |
@@ -388,7 +388,7 @@ int exfat_alloc_cluster(struct inode *inode, unsigned int num_alloc,
|
|
Kmods SIG |
9e3ffb |
}
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
/* update allocation bitmap */
|
|
Kmods SIG |
9e3ffb |
- if (exfat_set_bitmap(inode, new_clu)) {
|
|
Kmods SIG |
9e3ffb |
+ if (exfat_set_bitmap(inode, new_clu, sync_bmap)) {
|
|
Kmods SIG |
9e3ffb |
ret = -EIO;
|
|
Kmods SIG |
9e3ffb |
goto free_cluster;
|
|
Kmods SIG |
9e3ffb |
}
|
|
Kmods SIG |
9e3ffb |
diff --git a/src/inode.c b/src/inode.c
|
|
Kmods SIG |
9e3ffb |
index 730373e0965aff2a8c366b34482c61afeec9cd56..1803ef3220fdbd6ca51470b736ca3ab596588fc3 100644
|
|
Kmods SIG |
9e3ffb |
--- a/src/inode.c
|
|
Kmods SIG |
9e3ffb |
+++ b/src/inode.c
|
|
Kmods SIG |
9e3ffb |
@@ -179,7 +179,8 @@ static int exfat_map_cluster(struct inode *inode, unsigned int clu_offset,
|
|
Kmods SIG |
9e3ffb |
return -EIO;
|
|
Kmods SIG |
9e3ffb |
}
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
- ret = exfat_alloc_cluster(inode, num_to_be_allocated, &new_clu);
|
|
Kmods SIG |
9e3ffb |
+ ret = exfat_alloc_cluster(inode, num_to_be_allocated, &new_clu,
|
|
Kmods SIG |
9e3ffb |
+ inode_needs_sync(inode));
|
|
Kmods SIG |
9e3ffb |
if (ret)
|
|
Kmods SIG |
9e3ffb |
return ret;
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
diff --git a/src/namei.c b/src/namei.c
|
|
Kmods SIG |
9e3ffb |
index d9e8ec689c55ca3e8511177de0c01dfe1d3c090a..1f7b3dc66fcd6fd5507f9d52d73d01cb69433afd 100644
|
|
Kmods SIG |
9e3ffb |
--- a/src/namei.c
|
|
Kmods SIG |
9e3ffb |
+++ b/src/namei.c
|
|
Kmods SIG |
9e3ffb |
@@ -340,7 +340,7 @@ static int exfat_find_empty_entry(struct inode *inode,
|
|
Kmods SIG |
9e3ffb |
exfat_chain_set(&clu, last_clu + 1, 0, p_dir->flags);
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
/* allocate a cluster */
|
|
Kmods SIG |
9e3ffb |
- ret = exfat_alloc_cluster(inode, 1, &clu);
|
|
Kmods SIG |
9e3ffb |
+ ret = exfat_alloc_cluster(inode, 1, &clu, IS_DIRSYNC(inode));
|
|
Kmods SIG |
9e3ffb |
if (ret)
|
|
Kmods SIG |
9e3ffb |
return ret;
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
--
|
|
Kmods SIG |
9e3ffb |
2.31.1
|
|
Kmods SIG |
9e3ffb |
|