You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "xiaoxiang781216 (via GitHub)" <gi...@apache.org> on 2023/02/11 07:00:11 UTC

[GitHub] [nuttx] xiaoxiang781216 commented on a diff in pull request #8496: fs/littlefs: add full support for LittleFS block device cfg in Kconfig

xiaoxiang781216 commented on code in PR #8496:
URL: https://github.com/apache/nuttx/pull/8496#discussion_r1103548888


##########
fs/littlefs/Kconfig:
##########
@@ -6,17 +6,81 @@ config FS_LITTLEFS
 		Build the LITTLEFS file system. https://github.com/littlefs-project/littlefs.
 
 if FS_LITTLEFS
+config FS_LITTLEFS_ADVANCED_BLOCK_DEVICE_CFG
+	bool "Enable full block device configuration"
+	default n
+	---help---
+		This enables full control over configuring read, program, block, cache, 
+		lookahead sizes and block count.
+
+if !FS_LITTLEFS_ADVANCED_BLOCK_DEVICE_CFG
 config FS_LITTLEFS_BLOCK_FACTOR
 	int "LITTLEFS Block size multiple factor"
 	default 4
 	---help---
-		Configure the cache size of the LITTLEFS file system with a multiple factor of the block size.
-	
+		Configure the cache size of the LittleFS file system with a multiple factor of the block size.
+endif
+
 config FS_LITTLEFS_BLOCK_CYCLE
-	int "LITTLEFS Block Cycle"
+	int "Block cycle"
 	default 200
 	---help---
-		Configure the block cycle of the LITTLEFS file system.
+		Number of erase cycles before Littlefs evicts metadata logs and moves
+		the metadata to another block. Suggested values are in the
+		range 100-1000, with large values having better performance at the cost
+		of less consistent wear distribution.
+
+		Set to -1 to disable block-level wear-leveling (recommended for RAM and FRAM).
+
+if FS_LITTLEFS_ADVANCED_BLOCK_DEVICE_CFG
+config FS_LITTLEFS_READ_SIZE
+	int "Read size"
+	default 16
+	---help---
+		Minimum size of a block read in bytes. All read operations will be a
+		multiple of this value.
+
+config FS_LITTLEFS_PROGRAM_SIZE
+	int "Program size"
+	default 16
+	---help---
+		Minimum size of a block program in bytes. All program operations will be
+		a multiple of this value
+
+config FS_LITTLEFS_BLOCK_SIZE
+	int "Block size"
+	default 4096
+	---help---
+		Size of an erasable block in bytes. This does not impact ram consumption
+		and may be larger than the physical erase size. However, non-inlined
+		files take up at minimum one block. Must be a multiple of the read and
+		program sizes.
+
+config FS_LITTLEFS_BLOCK_COUNT
+	int "Block count"
+	default 128
+	---help---
+		Number of erasable blocks on the device.
+
+config FS_LITTLEFS_CACHE_SIZE
+	int "Cache size"
+	default 16
+	---help---
+		Size of block caches in bytes. Each cache buffers a portion of a block in
+		RAM. The littlefs needs a read cache, a program cache, and one additional
+		cache per file. Larger caches can improve performance by storing more
+		data and reducing the number of disk accesses. Must be a multiple of the
+		read and program sizes, and a factor of the block size.
+
+config FS_LITTLEFS_LOOKAHEAD_SIZE
+	int "Lookahead size"
+	default 16

Review Comment:
   Changing default to 0, and compute lookahead_size if FS_LITTLEFS_LOOKAHEAD_SIZE equals 0.



##########
fs/littlefs/Kconfig:
##########
@@ -6,17 +6,81 @@ config FS_LITTLEFS
 		Build the LITTLEFS file system. https://github.com/littlefs-project/littlefs.
 
 if FS_LITTLEFS
+config FS_LITTLEFS_ADVANCED_BLOCK_DEVICE_CFG
+	bool "Enable full block device configuration"
+	default n
+	---help---
+		This enables full control over configuring read, program, block, cache, 
+		lookahead sizes and block count.
+
+if !FS_LITTLEFS_ADVANCED_BLOCK_DEVICE_CFG
 config FS_LITTLEFS_BLOCK_FACTOR
 	int "LITTLEFS Block size multiple factor"
 	default 4
 	---help---
-		Configure the cache size of the LITTLEFS file system with a multiple factor of the block size.
-	
+		Configure the cache size of the LittleFS file system with a multiple factor of the block size.
+endif
+
 config FS_LITTLEFS_BLOCK_CYCLE
-	int "LITTLEFS Block Cycle"
+	int "Block cycle"
 	default 200
 	---help---
-		Configure the block cycle of the LITTLEFS file system.
+		Number of erase cycles before Littlefs evicts metadata logs and moves
+		the metadata to another block. Suggested values are in the
+		range 100-1000, with large values having better performance at the cost
+		of less consistent wear distribution.
+
+		Set to -1 to disable block-level wear-leveling (recommended for RAM and FRAM).
+
+if FS_LITTLEFS_ADVANCED_BLOCK_DEVICE_CFG
+config FS_LITTLEFS_READ_SIZE
+	int "Read size"
+	default 16
+	---help---
+		Minimum size of a block read in bytes. All read operations will be a
+		multiple of this value.
+
+config FS_LITTLEFS_PROGRAM_SIZE
+	int "Program size"
+	default 16
+	---help---
+		Minimum size of a block program in bytes. All program operations will be
+		a multiple of this value
+
+config FS_LITTLEFS_BLOCK_SIZE

Review Comment:
   change to factor of mtd_geometry_s::erasesize



##########
fs/littlefs/Kconfig:
##########
@@ -6,17 +6,81 @@ config FS_LITTLEFS
 		Build the LITTLEFS file system. https://github.com/littlefs-project/littlefs.
 
 if FS_LITTLEFS
+config FS_LITTLEFS_ADVANCED_BLOCK_DEVICE_CFG
+	bool "Enable full block device configuration"
+	default n
+	---help---
+		This enables full control over configuring read, program, block, cache, 
+		lookahead sizes and block count.
+
+if !FS_LITTLEFS_ADVANCED_BLOCK_DEVICE_CFG
 config FS_LITTLEFS_BLOCK_FACTOR
 	int "LITTLEFS Block size multiple factor"
 	default 4
 	---help---
-		Configure the cache size of the LITTLEFS file system with a multiple factor of the block size.
-	
+		Configure the cache size of the LittleFS file system with a multiple factor of the block size.
+endif
+
 config FS_LITTLEFS_BLOCK_CYCLE
-	int "LITTLEFS Block Cycle"
+	int "Block cycle"
 	default 200
 	---help---
-		Configure the block cycle of the LITTLEFS file system.
+		Number of erase cycles before Littlefs evicts metadata logs and moves
+		the metadata to another block. Suggested values are in the
+		range 100-1000, with large values having better performance at the cost
+		of less consistent wear distribution.
+
+		Set to -1 to disable block-level wear-leveling (recommended for RAM and FRAM).
+
+if FS_LITTLEFS_ADVANCED_BLOCK_DEVICE_CFG
+config FS_LITTLEFS_READ_SIZE
+	int "Read size"
+	default 16
+	---help---
+		Minimum size of a block read in bytes. All read operations will be a
+		multiple of this value.
+
+config FS_LITTLEFS_PROGRAM_SIZE
+	int "Program size"
+	default 16
+	---help---
+		Minimum size of a block program in bytes. All program operations will be
+		a multiple of this value
+
+config FS_LITTLEFS_BLOCK_SIZE
+	int "Block size"
+	default 4096
+	---help---
+		Size of an erasable block in bytes. This does not impact ram consumption
+		and may be larger than the physical erase size. However, non-inlined
+		files take up at minimum one block. Must be a multiple of the read and
+		program sizes.
+
+config FS_LITTLEFS_BLOCK_COUNT
+	int "Block count"
+	default 128

Review Comment:
   it isn't good to bypass the value reported by mtd_geometry_s. The better approach is that:
   
   1. mtd driver report the physical property which match the hardware requirement
   2. littlefs Kconfig add xxx_FACTOR to increase the value reported item 1 for speed tuning, the default should match the hardware property
   3. Compute block size from item 2 plus mtd_geometry_s
   
   It's wrong to add Kconfig option which can be computed from other value, like FS_LITTLEFS_BLOCK_COUNT.



##########
fs/littlefs/Kconfig:
##########
@@ -6,17 +6,81 @@ config FS_LITTLEFS
 		Build the LITTLEFS file system. https://github.com/littlefs-project/littlefs.
 
 if FS_LITTLEFS
+config FS_LITTLEFS_ADVANCED_BLOCK_DEVICE_CFG
+	bool "Enable full block device configuration"
+	default n
+	---help---
+		This enables full control over configuring read, program, block, cache, 
+		lookahead sizes and block count.
+
+if !FS_LITTLEFS_ADVANCED_BLOCK_DEVICE_CFG
 config FS_LITTLEFS_BLOCK_FACTOR
 	int "LITTLEFS Block size multiple factor"
 	default 4
 	---help---
-		Configure the cache size of the LITTLEFS file system with a multiple factor of the block size.
-	
+		Configure the cache size of the LittleFS file system with a multiple factor of the block size.
+endif
+
 config FS_LITTLEFS_BLOCK_CYCLE
-	int "LITTLEFS Block Cycle"
+	int "Block cycle"
 	default 200
 	---help---
-		Configure the block cycle of the LITTLEFS file system.
+		Number of erase cycles before Littlefs evicts metadata logs and moves
+		the metadata to another block. Suggested values are in the
+		range 100-1000, with large values having better performance at the cost
+		of less consistent wear distribution.
+
+		Set to -1 to disable block-level wear-leveling (recommended for RAM and FRAM).
+
+if FS_LITTLEFS_ADVANCED_BLOCK_DEVICE_CFG
+config FS_LITTLEFS_READ_SIZE
+	int "Read size"
+	default 16
+	---help---
+		Minimum size of a block read in bytes. All read operations will be a
+		multiple of this value.
+
+config FS_LITTLEFS_PROGRAM_SIZE

Review Comment:
   change to factor of mtd_geometry_s::blocksize



##########
fs/littlefs/Kconfig:
##########
@@ -6,17 +6,81 @@ config FS_LITTLEFS
 		Build the LITTLEFS file system. https://github.com/littlefs-project/littlefs.
 
 if FS_LITTLEFS
+config FS_LITTLEFS_ADVANCED_BLOCK_DEVICE_CFG
+	bool "Enable full block device configuration"
+	default n
+	---help---
+		This enables full control over configuring read, program, block, cache, 
+		lookahead sizes and block count.
+
+if !FS_LITTLEFS_ADVANCED_BLOCK_DEVICE_CFG
 config FS_LITTLEFS_BLOCK_FACTOR
 	int "LITTLEFS Block size multiple factor"
 	default 4
 	---help---
-		Configure the cache size of the LITTLEFS file system with a multiple factor of the block size.
-	
+		Configure the cache size of the LittleFS file system with a multiple factor of the block size.
+endif
+
 config FS_LITTLEFS_BLOCK_CYCLE
-	int "LITTLEFS Block Cycle"
+	int "Block cycle"
 	default 200
 	---help---
-		Configure the block cycle of the LITTLEFS file system.
+		Number of erase cycles before Littlefs evicts metadata logs and moves
+		the metadata to another block. Suggested values are in the
+		range 100-1000, with large values having better performance at the cost
+		of less consistent wear distribution.
+
+		Set to -1 to disable block-level wear-leveling (recommended for RAM and FRAM).
+
+if FS_LITTLEFS_ADVANCED_BLOCK_DEVICE_CFG
+config FS_LITTLEFS_READ_SIZE
+	int "Read size"
+	default 16

Review Comment:
   default FS_LITTLEFS_PROGRAM_SIZE



##########
fs/littlefs/Kconfig:
##########
@@ -6,17 +6,81 @@ config FS_LITTLEFS
 		Build the LITTLEFS file system. https://github.com/littlefs-project/littlefs.
 
 if FS_LITTLEFS
+config FS_LITTLEFS_ADVANCED_BLOCK_DEVICE_CFG
+	bool "Enable full block device configuration"
+	default n
+	---help---
+		This enables full control over configuring read, program, block, cache, 
+		lookahead sizes and block count.
+
+if !FS_LITTLEFS_ADVANCED_BLOCK_DEVICE_CFG
 config FS_LITTLEFS_BLOCK_FACTOR
 	int "LITTLEFS Block size multiple factor"
 	default 4
 	---help---
-		Configure the cache size of the LITTLEFS file system with a multiple factor of the block size.
-	
+		Configure the cache size of the LittleFS file system with a multiple factor of the block size.
+endif
+
 config FS_LITTLEFS_BLOCK_CYCLE
-	int "LITTLEFS Block Cycle"
+	int "Block cycle"
 	default 200
 	---help---
-		Configure the block cycle of the LITTLEFS file system.
+		Number of erase cycles before Littlefs evicts metadata logs and moves
+		the metadata to another block. Suggested values are in the
+		range 100-1000, with large values having better performance at the cost
+		of less consistent wear distribution.
+
+		Set to -1 to disable block-level wear-leveling (recommended for RAM and FRAM).
+
+if FS_LITTLEFS_ADVANCED_BLOCK_DEVICE_CFG
+config FS_LITTLEFS_READ_SIZE
+	int "Read size"
+	default 16
+	---help---
+		Minimum size of a block read in bytes. All read operations will be a
+		multiple of this value.
+
+config FS_LITTLEFS_PROGRAM_SIZE
+	int "Program size"
+	default 16
+	---help---
+		Minimum size of a block program in bytes. All program operations will be
+		a multiple of this value
+
+config FS_LITTLEFS_BLOCK_SIZE
+	int "Block size"
+	default 4096
+	---help---
+		Size of an erasable block in bytes. This does not impact ram consumption
+		and may be larger than the physical erase size. However, non-inlined
+		files take up at minimum one block. Must be a multiple of the read and
+		program sizes.
+
+config FS_LITTLEFS_BLOCK_COUNT
+	int "Block count"
+	default 128
+	---help---
+		Number of erasable blocks on the device.
+
+config FS_LITTLEFS_CACHE_SIZE
+	int "Cache size"
+	default 16

Review Comment:
   Default to FS_LITTLEFS_READ_SIZE



##########
fs/littlefs/Kconfig:
##########
@@ -6,17 +6,81 @@ config FS_LITTLEFS
 		Build the LITTLEFS file system. https://github.com/littlefs-project/littlefs.
 
 if FS_LITTLEFS
+config FS_LITTLEFS_ADVANCED_BLOCK_DEVICE_CFG

Review Comment:
   let's remove FS_LITTLEFS_ADVANCED_BLOCK_DEVICE_CFG and extend the config option directly



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org