Skip to contentSkip to conversation

exfat: remove useless directory scan in exfat_add_entry()

PATCH Applied Tetsuhiro Kohada 3 participants 3 messages Sep 11, 2020 – Sep 21, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 exfat: remove useless directory scan in exfat_add_entry()

There is nothing in directory just created, so there is no need to scan.

---
 fs/exfat/namei.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)
fs/exfat/namei.c +1 -10
index b966b9120c9c..803748946ddb 100644
@@ -530,19 +530,10 @@ static int exfat_add_entry(struct inode *inode, const char *path,
 		info->size = 0;
 		info->num_subdirs = 0;
 	} else {
-		int count;
-		struct exfat_chain cdir;
-
 		info->attr = ATTR_SUBDIR;
 		info->start_clu = start_clu;
 		info->size = clu_size;
-
-		exfat_chain_set(&cdir, info->start_clu,
-			EXFAT_B_TO_CLU(info->size, sbi), info->flags);
-		count = exfat_count_dir_entries(sb, &cdir);
-		if (count < 0)
-			return -EIO;
-		info->num_subdirs = count + EXFAT_MIN_SUBDIR;
+		info->num_subdirs = EXFAT_MIN_SUBDIR;
 	}
 	memset(&info->crtime, 0, sizeof(info->crtime));
 	memset(&info->mtime, 0, sizeof(info->mtime));
Signature · 1 line
2.25.1
maintainer Acked-by on v1 1/3
#1 lore raw
Quoted 3 lines

There is nothing in directory just created, so there is no need to scan.

Quoted 32 lines
---
 fs/exfat/namei.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)
fs/exfat/namei.c index renamed from fs/exfat/namei.c +0 -0

b966b9120c9c..803748946ddb 100644

fs/exfat/namei.c +1 -10
@@ -530,19 +530,10 @@ static int exfat_add_entry(struct inode *inode,
 const char *path,
 		info->size = 0;
 		info->num_subdirs = 0;
 	} else {
-		int count;
-		struct exfat_chain cdir;
-
 		info->attr = ATTR_SUBDIR;
 		info->start_clu = start_clu;
 		info->size = clu_size;
-
-		exfat_chain_set(&cdir, info->start_clu,
-			EXFAT_B_TO_CLU(info->size, sbi), info->flags);
-		count = exfat_count_dir_entries(sb, &cdir);
-		if (count < 0)
-			return -EIO;
-		info->num_subdirs = count + EXFAT_MIN_SUBDIR;
+		info->num_subdirs = EXFAT_MIN_SUBDIR;
 	}
 	memset(&info->crtime, 0, sizeof(info->crtime));

memset(&info->mtime, 0, sizeof(info->mtime));
--
2.25.1