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 --- fs/fat/fat.c | 1 + 1 file changed, 1 insertion(+) (limited to 'fs/fat/fat.c') diff --git a/fs/fat/fat.c b/fs/fat/fat.c index 826bd85286..df9f2b5656 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -876,6 +876,7 @@ int do_fat_read_at(const char *filename, loff_t pos, void *buffer, } mydata->fatbufnum = -1; + mydata->fat_dirty = 0; mydata->fatbuf = memalign(ARCH_DMA_MINALIGN, FATBUFSIZE); if (mydata->fatbuf == NULL) { debug("Error: allocating memory\n"); -- cgit v1.2.3