summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorDaniel Palmer <[email protected]>2026-03-11 07:06:18 +0900
committerTom Rini <[email protected]>2026-03-27 13:14:18 -0600
commit29cb951e8ca6a9feecd920da31af9f18918057fe (patch)
tree0d18f0274b747c0e454c8d32efbc4912b1627e40 /fs
parentce98d46395b748ecaf9ca1398d3b7e78e123bfd7 (diff)
fs: fat: Refactor dirty flag handling
Refactor the dirty flag handling a little bit so an inline function is called instead of directly stuffing a value into the variable. This allows variable that holds the flag to be completely removed if its not used i.e. CONFIG_FAT_WIRTE=n Signed-off-by: Daniel Palmer <[email protected]>
Diffstat (limited to 'fs')
-rw-r--r--fs/fat/fat.c2
-rw-r--r--fs/fat/fat_write.c9
2 files changed, 5 insertions, 6 deletions
diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index 85b511f75af..31c136e3b9e 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -832,7 +832,7 @@ static int get_fs_info(fsdata *mydata)
}
mydata->fatbufnum = -1;
- mydata->fat_dirty = 0;
+ fat_mark_clean(mydata);
mydata->fatbuf = malloc_cache_aligned(FATBUFSIZE);
if (mydata->fatbuf == NULL) {
debug("Error: allocating memory\n");
diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c
index 02e006f7c9e..c98b530f747 100644
--- a/fs/fat/fat_write.c
+++ b/fs/fat/fat_write.c
@@ -225,9 +225,9 @@ static int flush_dirty_fat_buffer(fsdata *mydata)
__u32 startblock = mydata->fatbufnum * FATBUFBLOCKS;
debug("debug: evicting %d, dirty: %d\n", mydata->fatbufnum,
- (int)mydata->fat_dirty);
+ (int)fat_is_dirty(mydata));
- if ((!mydata->fat_dirty) || (mydata->fatbufnum == -1))
+ if (!fat_is_dirty(mydata) || (mydata->fatbufnum == -1))
return 0;
/* Cap length if fatlength is not a multiple of FATBUFBLOCKS */
@@ -250,7 +250,7 @@ static int flush_dirty_fat_buffer(fsdata *mydata)
return -1;
}
}
- mydata->fat_dirty = 0;
+ fat_mark_clean(mydata);
return 0;
}
@@ -486,8 +486,7 @@ static int set_fatent_value(fsdata *mydata, __u32 entry, __u32 entry_value)
mydata->fatbufnum = bufnum;
}
- /* Mark as dirty */
- mydata->fat_dirty = 1;
+ fat_mark_dirty(mydata);
/* Set the actual entry */
switch (mydata->fatsize) {