lkml.org 
[lkml]   [2009]   [Jun]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] FAT: optimize FSINFO writeback
Date
steve@digidescorp.com writes:

> Only write the FSINFO block back to disk when its contents change.
> This optimization can be important when the underlying physical media
> can wear out, i.e. Flash.

I have no objection to this though. Was this tested on recent version?
Well, now, we are using sb->s_dirty for fsinfo, so I'm wondering why
this happen frequently.

Thanks.

> Signed-off-by: Steven J. Magnani <steve@digidescorp.com>
> ---
> diff -uprN a/fs/fat/misc.c b/fs/fat/misc.c
> --- a/fs/fat/misc.c 2009-06-29 11:12:40.000000000 -0500
> +++ b/fs/fat/misc.c 2009-06-29 11:46:45.000000000 -0500
> @@ -61,11 +61,25 @@ void fat_clusters_flush(struct super_blo
> le32_to_cpu(fsinfo->signature2),
> sbi->fsinfo_sector);
> } else {
> - if (sbi->free_clusters != -1)
> - fsinfo->free_clusters = cpu_to_le32(sbi->free_clusters);
> - if (sbi->prev_free != -1)
> - fsinfo->next_cluster = cpu_to_le32(sbi->prev_free);
> - mark_buffer_dirty(bh);
> + char write_needed = 0;
> + __le32 le_value;
> +
> + if (sbi->free_clusters != -1) {
> + le_value = cpu_to_le32(sbi->free_clusters);
> + if (fsinfo->free_clusters != le_value) {
> + fsinfo->free_clusters = le_value;
> + write_needed = 1;
> + }
> + }
> + if (sbi->prev_free != -1) {
> + le_value = cpu_to_le32(sbi->prev_free);
> + if (fsinfo->next_cluster != le_value) {
> + fsinfo->next_cluster = le_value;
> + write_needed = 1;
> + }
> + }
> + if (write_needed)
> + mark_buffer_dirty(bh);
> }
> brelse(bh);
> }
>

--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>


\
 
 \ /
  Last update: 2009-06-30 22:59    [W:0.087 / U:0.976 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site