summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorTien Fong Chee <tien.fong.chee@intel.com>2019-02-11 14:56:20 +0800
committerTom Rini <trini@konsulko.com>2019-02-19 08:55:43 -0500
commite48485f5e4f99811ba41e89f782a3f282f3c5a2e (patch)
tree4f5f7fef83f1559fd19abdfd53878c430c436aa4 /fs
parent8537874a6585251843f462c16b1684d38c887996 (diff)
fs: fat: Reduce default max clustersize 64KiB from malloc pool
Release cluster block immediately when no longer use would help to reduce 64KiB memory allocated to the memory pool. Signed-off-by: Tien Fong Chee <tien.fong.chee@intel.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/fat/fat.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index f593e989ff..6ade4ea54e 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -1148,7 +1148,15 @@ int file_fat_read_at(const char *filename, loff_t pos, void *buffer,
goto out_free_both;
debug("reading %s at pos %llu\n", filename, pos);
- ret = get_contents(&fsdata, itr->dent, pos, buffer, maxsize, actread);
+
+ /* For saving default max clustersize memory allocated to malloc pool */
+ dir_entry *dentptr = itr->dent;
+
+ free(itr);
+
+ itr = NULL;
+
+ ret = get_contents(&fsdata, dentptr, pos, buffer, maxsize, actread);
out_free_both:
free(fsdata.fatbuf);