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


##########
fs/littlefs/Kconfig:
##########
@@ -6,17 +6,69 @@ config FS_LITTLEFS
                Build the LITTLEFS file system. 
https://github.com/littlefs-project/littlefs.
 
 if FS_LITTLEFS
-config FS_LITTLEFS_BLOCK_FACTOR
-       int "LITTLEFS Block size multiple factor"
+config FS_LITTLEFS_PROGRAM_SIZE_FACTOR
+       int "LITTLEFS Program size multiplication factor"
+       default 1
+       ---help---
+               A factor used for multiplying program size.
+
+               The result is used as the minimum size of a block program in 
bytes.
+               All program operations will be a multiple of the result.
+
+config FS_LITTLEFS_READ_SIZE_FACTOR
+       int "LITTLEFS Read size multiplication factor"
+       default FS_LITTLEFS_PROGRAM_SIZE_FACTOR
+       ---help---
+               A factor used for multiplying read size.
+
+               The result is used as the minimum size of a block read in bytes.
+               All read operations will be a multiple of the result.
+
+config FS_LITTLEFS_BLOCK_SIZE_FACTOR
+       int "LITTLEFS Block size multiplication factor"
        default 4
        ---help---
-               Configure the cache size of the LITTLEFS file system with a 
multiple factor of the block size.
-       
+               A factor used for multiplying block size and dividing block 
count.
+
+               The result is 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_CACHE_SIZE_FACTOR
+       int "LITTLEFS Cache size multiplication factor"
+       default FS_LITTLEFS_PROGRAM_SIZE_FACTOR

Review Comment:
   ```suggestion
        default FS_LITTLEFS_READ_SIZE_FACTOR
   ```



##########
fs/littlefs/Kconfig:
##########
@@ -6,17 +6,69 @@ config FS_LITTLEFS
                Build the LITTLEFS file system. 
https://github.com/littlefs-project/littlefs.
 
 if FS_LITTLEFS
-config FS_LITTLEFS_BLOCK_FACTOR
-       int "LITTLEFS Block size multiple factor"
+config FS_LITTLEFS_PROGRAM_SIZE_FACTOR
+       int "LITTLEFS Program size multiplication factor"
+       default 1
+       ---help---
+               A factor used for multiplying program size.
+
+               The result is used as the minimum size of a block program in 
bytes.
+               All program operations will be a multiple of the result.
+
+config FS_LITTLEFS_READ_SIZE_FACTOR
+       int "LITTLEFS Read size multiplication factor"
+       default FS_LITTLEFS_PROGRAM_SIZE_FACTOR
+       ---help---
+               A factor used for multiplying read size.
+
+               The result is used as the minimum size of a block read in bytes.
+               All read operations will be a multiple of the result.
+
+config FS_LITTLEFS_BLOCK_SIZE_FACTOR
+       int "LITTLEFS Block size multiplication factor"
        default 4
        ---help---
-               Configure the cache size of the LITTLEFS file system with a 
multiple factor of the block size.

Review Comment:
   change the default to 1. If we keep the old defsult setting, 
FS_LITTLEFS_PROGRAM_SIZE_FACTOR defsult value should to 4 instead



##########
fs/littlefs/lfs_vfs.c:
##########
@@ -1088,15 +1088,23 @@ static int littlefs_bind(FAR struct inode *driver, FAR 
const void *data,
   fs->cfg.erase          = littlefs_erase_block;
   fs->cfg.sync           = littlefs_sync_block;
   fs->cfg.read_size      = fs->geo.blocksize *
-                           CONFIG_FS_LITTLEFS_BLOCK_FACTOR;
-  fs->cfg.prog_size      = fs->geo.blocksize;
-  fs->cfg.block_size     = fs->geo.erasesize;
-  fs->cfg.block_count    = fs->geo.neraseblocks;
+                           CONFIG_FS_LITTLEFS_READ_SIZE_FACTOR;
+  fs->cfg.prog_size      = fs->geo.blocksize *
+                           CONFIG_FS_LITTLEFS_PROGRAM_SIZE_FACTOR;
+  fs->cfg.block_size     = fs->geo.erasesize *
+                           CONFIG_FS_LITTLEFS_BLOCK_SIZE_FACTOR;
+  fs->cfg.block_count    = fs->geo.neraseblocks /
+                           CONFIG_FS_LITTLEFS_BLOCK_SIZE_FACTOR;
   fs->cfg.block_cycles   = CONFIG_FS_LITTLEFS_BLOCK_CYCLE;
   fs->cfg.cache_size     = fs->geo.blocksize *
-                           CONFIG_FS_LITTLEFS_BLOCK_FACTOR;
+                           CONFIG_FS_LITTLEFS_CACHE_SIZE_FACTOR;
+
+#ifdef (FS_LITTLEFS_LOOKAHEAD_SIZE == 0)

Review Comment:
   ```suggestion
   #if FS_LITTLEFS_LOOKAHEAD_SIZE == 0
   ```



-- 
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-unsubscr...@nuttx.apache.org

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

Reply via email to