linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tetsuhiro Kohada <kohada.t2@gmail.com>
To: kohada.t2@gmail.com
Cc: kohada.tetsuhiro@dc.mitsubishielectric.co.jp,
	mori.takahiro@ab.mitsubishielectric.co.jp,
	Namjae Jeon <namjae.jeon@samsung.com>,
	Sungjong Seo <sj1557.seo@samsung.com>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] exfat: simplify exfat_hint_femp structure
Date: Wed, 21 Oct 2020 18:55:44 +0900	[thread overview]
Message-ID: <20201021095545.9208-1-kohada.t2@gmail.com> (raw)

The hint provided by exfat_hint_femp is that the cluster number is enough,
so replace exfat_chain with the cluster number.

Signed-off-by: Tetsuhiro Kohada <kohada.t2@gmail.com>
---
 fs/exfat/dir.c      |  3 +--
 fs/exfat/exfat_fs.h |  2 +-
 fs/exfat/namei.c    | 19 ++++++-------------
 3 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/fs/exfat/dir.c b/fs/exfat/dir.c
index ff809239a540..2e68796750b0 100644
--- a/fs/exfat/dir.c
+++ b/fs/exfat/dir.c
@@ -978,8 +978,7 @@ int exfat_find_dir_entry(struct super_block *sb, struct exfat_inode_info *ei,
 				num_empty++;
 				if (candi_empty.eidx == EXFAT_HINT_NONE &&
 						num_empty == 1) {
-					exfat_chain_set(&candi_empty.cur,
-						clu.dir, clu.size, clu.flags);
+					candi_empty.clu = clu.dir;
 				}
 
 				if (candi_empty.eidx == EXFAT_HINT_NONE &&
diff --git a/fs/exfat/exfat_fs.h b/fs/exfat/exfat_fs.h
index f1402fed3302..28330804f9c9 100644
--- a/fs/exfat/exfat_fs.h
+++ b/fs/exfat/exfat_fs.h
@@ -153,7 +153,7 @@ struct exfat_hint_femp {
 	/* count of continuous empty entry */
 	int count;
 	/* the cluster that first empty slot exists in */
-	struct exfat_chain cur;
+	unsigned int clu;
 };
 
 /* hint structure */
diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c
index 54f54624d7e5..cfe11b368122 100644
--- a/fs/exfat/namei.c
+++ b/fs/exfat/namei.c
@@ -202,10 +202,10 @@ static int exfat_search_empty_slot(struct super_block *sb,
 		struct exfat_hint_femp *hint_femp, struct exfat_chain *p_dir,
 		int num_entries)
 {
-	int i, dentry, num_empty = 0;
+	int i, dentry = 0, num_empty = 0;
 	int dentries_per_clu;
 	unsigned int type;
-	struct exfat_chain clu;
+	struct exfat_chain clu = *p_dir;
 	struct exfat_dentry *ep;
 	struct exfat_sb_info *sbi = EXFAT_SB(sb);
 	struct buffer_head *bh;
@@ -218,11 +218,8 @@ static int exfat_search_empty_slot(struct super_block *sb,
 			hint_femp->eidx = EXFAT_HINT_NONE;
 			return dentry;
 		}
-
-		exfat_chain_dup(&clu, &hint_femp->cur);
-	} else {
-		exfat_chain_dup(&clu, p_dir);
-		dentry = 0;
+		clu.dir = hint_femp->clu;
+		clu.size -= EXFAT_B_TO_CLU(dentry * DENTRY_SIZE, sbi);
 	}
 
 	while (clu.dir != EXFAT_EOF_CLUSTER) {
@@ -240,8 +237,7 @@ static int exfat_search_empty_slot(struct super_block *sb,
 				if (hint_femp->eidx == EXFAT_HINT_NONE) {
 					hint_femp->eidx = dentry;
 					hint_femp->count = CNT_UNUSED_NOHIT;
-					exfat_chain_set(&hint_femp->cur,
-						clu.dir, clu.size, clu.flags);
+					hint_femp->clu = clu.dir;
 				}
 
 				if (type == TYPE_UNUSED &&
@@ -354,7 +350,6 @@ static int exfat_find_empty_entry(struct inode *inode,
 			 */
 			exfat_chain_cont_cluster(sb, p_dir->dir, p_dir->size);
 			p_dir->flags = ALLOC_FAT_CHAIN;
-			hint_femp.cur.flags = ALLOC_FAT_CHAIN;
 		}
 
 		if (clu.flags == ALLOC_FAT_CHAIN)
@@ -367,10 +362,8 @@ static int exfat_find_empty_entry(struct inode *inode,
 			 */
 			hint_femp.eidx = EXFAT_B_TO_DEN_IDX(p_dir->size, sbi);
 			hint_femp.count = sbi->dentries_per_clu;
-
-			exfat_chain_set(&hint_femp.cur, clu.dir, 0, clu.flags);
+			hint_femp.clu = clu.dir;
 		}
-		hint_femp.cur.size++;
 		p_dir->size++;
 		size = EXFAT_CLU_TO_B(p_dir->size, sbi);
 
-- 
2.25.1


                 reply	other threads:[~2020-10-21  9:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201021095545.9208-1-kohada.t2@gmail.com \
    --to=kohada.t2@gmail.com \
    --cc=kohada.tetsuhiro@dc.mitsubishielectric.co.jp \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mori.takahiro@ab.mitsubishielectric.co.jp \
    --cc=namjae.jeon@samsung.com \
    --cc=sj1557.seo@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).