mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-01 03:34:32 +02:00
feat(fatfs): Add Kconfig options to set FF_FS_NOFSINFO value
Closes https://github.com/espressif/esp-idf/issues/15241
This commit is contained in:
@@ -310,6 +310,7 @@ menu "FAT Filesystem support"
|
||||
If enabled, the whole link operation (including file copying) is performed under lock.
|
||||
This ensures that the link operation is atomic, but may cause performance for large files.
|
||||
It may create less fragmented file copy.
|
||||
|
||||
config FATFS_USE_DYN_BUFFERS
|
||||
bool "Use dynamic buffers"
|
||||
depends on CONFIG_WL_SECTOR_SIZE_4096
|
||||
@@ -321,4 +322,27 @@ menu "FAT Filesystem support"
|
||||
If disabled, the greatest sector size will be used for all FATFS instances.
|
||||
(In most cases, this would be the sector size of Wear Levelling library)
|
||||
This might cause more memory to be used than necessary.
|
||||
|
||||
menu "File system free space calculation behavior"
|
||||
help
|
||||
Controls if the file system does or does not trust cached data like free cluster count and allocated
|
||||
cluster number. Setting these to do not trust the data may result of more accurate output from
|
||||
`f_getfree()` function but increased overhead (forces a full FAT scan, etc.).
|
||||
|
||||
config FATFS_DONT_TRUST_FREE_CLUSTER_CNT
|
||||
int "Don't trust free cluster count"
|
||||
default 0
|
||||
range 0 1
|
||||
help
|
||||
If 1, the file system will not trust the free cluster count in the FSINFO (in FATFS struct).
|
||||
This may result in more accurate output from `f_getfree()` function but increased overhead.
|
||||
|
||||
config FATFS_DONT_TRUST_LAST_ALLOC
|
||||
int "Don't trust allocated cluster number"
|
||||
default 0
|
||||
range 0 1
|
||||
help
|
||||
If 1, the file system will not trust the last allocated cluster number in the FSINFO (in FATFS struct).
|
||||
This may result in more accurate output from `f_getfree()` function but increased overhead.
|
||||
endmenu
|
||||
endmenu
|
||||
|
@@ -299,7 +299,7 @@
|
||||
/ These options have no effect in read-only configuration (FF_FS_READONLY = 1). */
|
||||
|
||||
|
||||
#define FF_FS_NOFSINFO 0
|
||||
#define FF_FS_NOFSINFO (CONFIG_FATFS_DONT_TRUST_FREE_CLUSTER_CNT << 0 | CONFIG_FATFS_DONT_TRUST_LAST_ALLOC << 1)
|
||||
/* If you need to know correct free space on the FAT32 volume, set bit 0 of this
|
||||
/ option, and f_getfree() function at the first time after volume mount will force
|
||||
/ a full FAT scan. Bit 1 controls the use of last allocated cluster number.
|
||||
|
@@ -69,10 +69,20 @@ Configuration options
|
||||
The following configuration options are available for the FatFs component:
|
||||
|
||||
* :ref:`CONFIG_FATFS_USE_FASTSEEK` - If enabled, the POSIX :cpp:func:`lseek` function will be performed faster. The fast seek does not work for files in write mode, so to take advantage of fast seek, you should open (or close and then reopen) the file in read-only mode.
|
||||
* :ref:`CONFIG_FATFS_IMMEDIATE_FSYNC` - If enabled, the FatFs will automatically call :cpp:func:`f_sync` to flush recent file changes after each call of :cpp:func:`write`, :cpp:func:`pwrite`, :cpp:func:`link`, :cpp:func:`truncate` and :cpp:func:`ftruncate` functions. This feature improves file-consistency and size reporting accuracy for the FatFs, at a price on decreased performance due to frequent disk operations.
|
||||
* :ref:`CONFIG_FATFS_IMMEDIATE_FSYNC` - If enabled, the FatFs will automatically call :cpp:func:`f_sync` to flush recent file changes after each call of :cpp:func:`write`, :cpp:func:`pwrite`, :cpp:func:`link`, :cpp:func:`truncate` and :cpp:func:`ftruncate` functions. This feature improves file-consistency and size reporting accuracy for the FatFs, at a price of decreased performance due to frequent disk operations.
|
||||
* :ref:`CONFIG_FATFS_LINK_LOCK` - If enabled, this option guarantees the API thread safety, while disabling this option might be necessary for applications that require fast frequent small file operations (e.g., logging to a file). Note that if this option is disabled, the copying performed by :cpp:func:`link` will be non-atomic. In such case, using :cpp:func:`link` on a large file on the same volume in a different task is not guaranteed to be thread safe.
|
||||
|
||||
|
||||
These options set a behavior of how the FATFS filesystem calculates and reports free space:
|
||||
|
||||
* :ref:`CONFIG_FATFS_DONT_TRUST_FREE_CLUSTER_CNT` - If 1, free cluster count will be ignored. Default value is 0.
|
||||
* :ref:`CONFIG_FATFS_DONT_TRUST_LAST_ALLOC` - If 1, last allocation number will be ignored. Default value is 0.
|
||||
|
||||
.. note::
|
||||
|
||||
Setting these settings to 1 may increase the accuracy of :cpp:func:`f_getfree` output at a price of decreased performance, e.g. due to performing full FAT scan.
|
||||
|
||||
|
||||
.. _fatfs-diskio-layer:
|
||||
|
||||
FatFS Disk IO Layer
|
||||
|
Reference in New Issue
Block a user