[PATCH 2/2] staging: exfat: dedicate count_entries() to sub-dir counting.

From: Tetsuhiro Kohada
Date: Mon Feb 03 2020 - 03:02:43 EST


count_entries() function is only used to count sub-dirs.
Clarify the role and rename to count_dir_entries().

Signed-off-by: Tetsuhiro Kohada <Kohada.Tetsuhiro@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
---
drivers/staging/exfat/exfat.h | 2 +-
drivers/staging/exfat/exfat_core.c | 8 ++------
drivers/staging/exfat/exfat_super.c | 4 ++--
3 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/exfat/exfat.h b/drivers/staging/exfat/exfat.h
index 62aba0feda12..be0ce8998cce 100644
--- a/drivers/staging/exfat/exfat.h
+++ b/drivers/staging/exfat/exfat.h
@@ -694,7 +694,7 @@ struct entry_set_cache_t *get_entry_set_in_dir(struct super_block *sb,
u32 type,
struct dentry_t **file_ep);
void release_entry_set(struct entry_set_cache_t *es);
-s32 count_entries(struct super_block *sb, struct chain_t *p_dir, u32 type);
+s32 count_dir_entries(struct super_block *sb, struct chain_t *p_dir);
void update_dir_checksum(struct super_block *sb, struct chain_t *p_dir,
s32 entry);
void update_dir_checksum_with_entry_set(struct super_block *sb,
diff --git a/drivers/staging/exfat/exfat_core.c b/drivers/staging/exfat/exfat_core.c
index 188349eeef5f..a9c86aae688b 100644
--- a/drivers/staging/exfat/exfat_core.c
+++ b/drivers/staging/exfat/exfat_core.c
@@ -1854,7 +1854,7 @@ s32 exfat_count_ext_entries(struct super_block *sb, struct chain_t *p_dir,
return count;
}

-s32 count_entries(struct super_block *sb, struct chain_t *p_dir, u32 type)
+s32 count_dir_entries(struct super_block *sb, struct chain_t *p_dir)
{
int i, count = 0;
s32 dentries_per_clu;
@@ -1885,11 +1885,7 @@ s32 count_entries(struct super_block *sb, struct chain_t *p_dir, u32 type)

if (entry_type == TYPE_UNUSED)
return count;
- if (!(type & TYPE_CRITICAL_PRI) &&
- !(type & TYPE_BENIGN_PRI))
- continue;
-
- if ((type == TYPE_ALL) || (type == entry_type))
+ if (entry_type == TYPE_DIR)
count++;
}

diff --git a/drivers/staging/exfat/exfat_super.c b/drivers/staging/exfat/exfat_super.c
index ae666f79ff48..e706fdd667ed 100644
--- a/drivers/staging/exfat/exfat_super.c
+++ b/drivers/staging/exfat/exfat_super.c
@@ -1476,7 +1476,7 @@ static int ffsReadStat(struct inode *inode, struct dir_entry_t *info)
p_fs->cluster_size_bits;
}

- count = count_entries(sb, &dir, TYPE_DIR);
+ count = count_dir_entries(sb, &dir);
if (count < 0) {
ret = count; /* propagate error upward */
goto out;
@@ -1543,7 +1543,7 @@ static int ffsReadStat(struct inode *inode, struct dir_entry_t *info)
info->Size = (u64)count_num_clusters(sb, &dir) <<
p_fs->cluster_size_bits;

- count = count_entries(sb, &dir, TYPE_DIR);
+ count = count_dir_entries(sb, &dir);
if (count < 0) {
ret = count; /* propagate error upward */
goto out;
--
2.25.0