From 3c0ed9c3a561ca744b2b76921bb8352ba2340669 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= Date: Sun, 11 Sep 2016 22:51:40 +0200 Subject: fs/fat: Do not write unmodified fat entries to disk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The code caches 6 sectors of the FAT. On FAT traversal, the old contents needs to be flushed to disk, but only if any FAT entries had been modified. Explicitly flag the buffer on modification. Currently, creating a new file traverses the whole FAT up to the first free cluster and rewrites the on-disk blocks. Signed-off-by: Stefan BrĂ¼ns Reviewed-by: Lukasz Majewski --- include/fat.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/fat.h b/include/fat.h index 9d053e6..8ec91cd 100644 --- a/include/fat.h +++ b/include/fat.h @@ -169,6 +169,7 @@ typedef struct { int fatsize; /* Size of FAT in bits */ __u32 fatlength; /* Length of FAT in sectors */ __u16 fat_sect; /* Starting sector of the FAT */ + __u8 fat_dirty; /* Set if fatbuf has been modified */ __u32 rootdir_sect; /* Start sector of root directory */ __u16 sect_size; /* Size of sectors in bytes */ __u16 clust_size; /* Size of clusters in sectors */ -- cgit v1.1