From: Artem Bityutskiy <dedekind1@gmail.com>
To: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Linux Kernel Maling List <linux-kernel@vger.kernel.org>,
Linux FS Maling List <linux-fsdevel@vger.kernel.org>,
Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Subject: [PATCH v1 2/3] fat: mark fsinfo as dirty less often
Date: Wed, 11 Apr 2012 14:45:06 +0300 [thread overview]
Message-ID: <1334144707-9729-3-git-send-email-dedekind1@gmail.com> (raw)
In-Reply-To: <1334144707-9729-1-git-send-email-dedekind1@gmail.com>
From: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
This is a preparation patch which amends several functions in fatent.c
and makes them call 'fat_mark_fsinfo_dirty()' only once at the end
versus many times in the loop as it is now. Also, this patch makes sure
'fat_mark_fsinfo_dirty()' is called only after we have unlocked the FAT
table ('unlock_fat()').
The reason for this patch is that 'fat_mark_fsinfo_dirty()' will soon
become a bit heavier so it is better to avoid calling it unnecessarily
and while having the FAT table locked.
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
---
fs/fat/fatent.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/fs/fat/fatent.c b/fs/fat/fatent.c
index 153c053..8e778ef 100644
--- a/fs/fat/fatent.c
+++ b/fs/fat/fatent.c
@@ -503,7 +503,6 @@ int fat_alloc_clusters(struct inode *inode, int *cluster, int nr_cluster)
sbi->prev_free = entry;
if (sbi->free_clusters != -1)
sbi->free_clusters--;
- fat_mark_fsinfo_dirty(sb);
cluster[idx_clus] = entry;
idx_clus++;
@@ -525,11 +524,11 @@ int fat_alloc_clusters(struct inode *inode, int *cluster, int nr_cluster)
/* Couldn't allocate the free entries */
sbi->free_clusters = 0;
sbi->free_clus_valid = 1;
- fat_mark_fsinfo_dirty(sb);
err = -ENOSPC;
out:
unlock_fat(sbi);
+ fat_mark_fsinfo_dirty(sb);
fatent_brelse(&fatent);
if (!err) {
if (inode_needs_sync(inode))
@@ -590,10 +589,8 @@ int fat_free_clusters(struct inode *inode, int cluster)
}
ops->ent_put(&fatent, FAT_ENT_FREE);
- if (sbi->free_clusters != -1) {
+ if (sbi->free_clusters != -1)
sbi->free_clusters++;
- fat_mark_fsinfo_dirty(sb);
- }
if (nr_bhs + fatent.nr_bhs > MAX_BUF_PER_PAGE) {
if (sb->s_flags & MS_SYNCHRONOUS) {
@@ -622,6 +619,8 @@ error:
for (i = 0; i < nr_bhs; i++)
brelse(bhs[i]);
unlock_fat(sbi);
+ if (!err)
+ fat_mark_fsinfo_dirty(sb);
return err;
}
@@ -682,9 +681,10 @@ int fat_count_free_clusters(struct super_block *sb)
}
sbi->free_clusters = free;
sbi->free_clus_valid = 1;
- fat_mark_fsinfo_dirty(sb);
fatent_brelse(&fatent);
out:
unlock_fat(sbi);
+ if (!err)
+ fat_mark_fsinfo_dirty(sb);
return err;
}
--
1.7.7.6
next prev parent reply other threads:[~2012-04-11 11:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-11 11:45 [PATCH v1 0/3] do not use s_dirt in FAT FS Artem Bityutskiy
2012-04-11 11:45 ` [PATCH v1 1/3] fat: introduce fat_mark_fsinfo_dirty helper Artem Bityutskiy
2012-04-11 11:45 ` Artem Bityutskiy [this message]
2012-04-11 11:45 ` [PATCH v1 3/3] fat: self-manage own fsinfo block Artem Bityutskiy
2012-04-13 0:12 ` [PATCH v1 0/3] do not use s_dirt in FAT FS Andrew Morton
2012-04-13 6:38 ` Artem Bityutskiy
2012-04-13 7:26 ` Andrew Morton
2012-04-13 8:45 ` Artem Bityutskiy
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=1334144707-9729-3-git-send-email-dedekind1@gmail.com \
--to=dedekind1@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=artem.bityutskiy@linux.intel.com \
--cc=hirofumi@mail.parknet.co.jp \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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).