lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1246392130-4261-1-git-send-email-steve@digidescorp.com>
Date:	Tue, 30 Jun 2009 15:02:10 -0500
From:	steve@...idescorp.com
To:	hirofumi@...l.parknet.co.jp, linux-kernel@...r.kernel.org
Cc:	"Steven J. Magnani" <steve@...idescorp.com>
Subject: [PATCH] FAT: optimize FSINFO writeback

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.

Signed-off-by: Steven J. Magnani <steve@...idescorp.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);
 }

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ