From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: Andrew Morton <akpm@osdl.org>, linux-kernel@vger.kernel.org
Subject: [PATCH 1/6] fat: move fat_clusters_flush() to write_super()
Date: Tue, 08 Nov 2005 02:32:29 +0900 [thread overview]
Message-ID: <87hdaotlci.fsf@devron.myhome.or.jp> (raw)
It is overkill to update the FS_INFO whenever modifying
prev_free/free_clusters, because those are just a hint.
So, this patch uses ->write_super() for updating FS_INFO instead.
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
---
fs/fat/fatent.c | 8 ++++++--
fs/fat/inode.c | 10 ++++++++--
fs/fat/misc.c | 2 --
3 files changed, 14 insertions(+), 6 deletions(-)
diff -puN fs/fat/fatent.c~fat_write_super fs/fat/fatent.c
--- linux-2.6.14/fs/fat/fatent.c~fat_write_super 2005-11-07 02:14:05.000000000 +0900
+++ linux-2.6.14-hirofumi/fs/fat/fatent.c 2005-11-07 03:46:35.000000000 +0900
@@ -476,6 +476,7 @@ int fat_alloc_clusters(struct inode *ino
sbi->prev_free = entry;
if (sbi->free_clusters != -1)
sbi->free_clusters--;
+ sb->s_dirt = 1;
cluster[idx_clus] = entry;
idx_clus++;
@@ -496,6 +497,7 @@ int fat_alloc_clusters(struct inode *ino
/* Couldn't allocate the free entries */
sbi->free_clusters = 0;
+ sb->s_dirt = 1;
err = -ENOSPC;
out:
@@ -509,7 +511,6 @@ out:
}
for (i = 0; i < nr_bhs; i++)
brelse(bhs[i]);
- fat_clusters_flush(sb);
if (err && idx_clus)
fat_free_clusters(inode, cluster[0]);
@@ -542,8 +543,10 @@ int fat_free_clusters(struct inode *inod
}
ops->ent_put(&fatent, FAT_ENT_FREE);
- if (sbi->free_clusters != -1)
+ if (sbi->free_clusters != -1) {
sbi->free_clusters++;
+ sb->s_dirt = 1;
+ }
if (nr_bhs + fatent.nr_bhs > MAX_BUF_PER_PAGE) {
if (sb->s_flags & MS_SYNCHRONOUS) {
@@ -605,6 +608,7 @@ int fat_count_free_clusters(struct super
} while (fat_ent_next(sbi, &fatent));
}
sbi->free_clusters = free;
+ sb->s_dirt = 1;
fatent_brelse(&fatent);
out:
unlock_fat(sbi);
diff -puN fs/fat/inode.c~fat_write_super fs/fat/inode.c
--- linux-2.6.14/fs/fat/inode.c~fat_write_super 2005-11-07 02:14:05.000000000 +0900
+++ linux-2.6.14-hirofumi/fs/fat/inode.c 2005-11-07 03:55:16.000000000 +0900
@@ -374,12 +374,17 @@ static void fat_clear_inode(struct inode
unlock_kernel();
}
-static void fat_put_super(struct super_block *sb)
+static void fat_write_super(struct super_block *sb)
{
- struct msdos_sb_info *sbi = MSDOS_SB(sb);
+ sb->s_dirt = 0;
if (!(sb->s_flags & MS_RDONLY))
fat_clusters_flush(sb);
+}
+
+static void fat_put_super(struct super_block *sb)
+{
+ struct msdos_sb_info *sbi = MSDOS_SB(sb);
if (sbi->nls_disk) {
unload_nls(sbi->nls_disk);
@@ -546,6 +551,7 @@ static struct super_operations fat_sops
.write_inode = fat_write_inode,
.delete_inode = fat_delete_inode,
.put_super = fat_put_super,
+ .write_super = fat_write_super,
.statfs = fat_statfs,
.clear_inode = fat_clear_inode,
.remount_fs = fat_remount,
diff -puN fs/fat/misc.c~fat_write_super fs/fat/misc.c
--- linux-2.6.14/fs/fat/misc.c~fat_write_super 2005-11-07 02:14:05.000000000 +0900
+++ linux-2.6.14-hirofumi/fs/fat/misc.c 2005-11-07 03:46:35.000000000 +0900
@@ -67,8 +67,6 @@ void fat_clusters_flush(struct super_blo
if (sbi->prev_free != -1)
fsinfo->next_cluster = cpu_to_le32(sbi->prev_free);
mark_buffer_dirty(bh);
- if (sb->s_flags & MS_SYNCHRONOUS)
- sync_dirty_buffer(bh);
}
brelse(bh);
}
_
next reply other threads:[~2005-11-07 17:32 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-07 17:32 OGAWA Hirofumi [this message]
2005-11-07 17:36 ` [PATCH] fat: use sb_find_get_block() instead of sb_getblk() OGAWA Hirofumi
2005-11-07 17:37 ` [PATCH 3/6] fat: add the read/writepages() OGAWA Hirofumi
2005-11-07 17:39 ` [PATCH 4/6] fat: s/EXPORT_SYMBOL/EXPORT_SYMBOL_GPL/ OGAWA Hirofumi
2005-11-07 17:41 ` [PATCH 5/6] fat: support ->direct_IO() OGAWA Hirofumi
2005-11-07 17:42 ` [PATCH 6/6] export/change sync_page_range/_nolock() OGAWA Hirofumi
2005-11-07 17:46 ` [PATCH 7/6] fat: Support a truncate() for expanding size OGAWA Hirofumi
2005-11-07 17:51 ` OGAWA Hirofumi
2005-11-08 1:06 ` Andrew Morton
2005-11-08 3:19 ` OGAWA Hirofumi
2005-11-08 4:19 ` Andrew Morton
2005-11-08 5:22 ` OGAWA Hirofumi
2005-11-08 20:40 ` OGAWA Hirofumi
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=87hdaotlci.fsf@devron.myhome.or.jp \
--to=hirofumi@mail.parknet.co.jp \
--cc=akpm@osdl.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