You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "resyfer (via GitHub)" <gi...@apache.org> on 2024/10/28 14:52:16 UTC

[PR] fs/mnemofs: Fix mkdir for depth > 3 bug, better logs [nuttx]

resyfer opened a new pull request, #14533:
URL: https://github.com/apache/nuttx/pull/14533

   ## Summary
   
   - Fix bug which prevents mkdir for depth > 3 (bug present in `mfs_get_patharr`).
   - Better logs for mnemofs
       - Improve logging macro `MFS_LOG` and `MFS_EXTRA_LOG`
       - Add logs for `mfs_get_patharr` and `next_child`.
   
   The former change is necessary as `mkdir` worked for mnemofs only upto 3 items in the requested path, but failed for anything more.
   
   The latter change is required to provide better logs for mnemofs.
   
   ## Impact
   - `mkdir` for any number of items in the path.
   - Better debugging using the improved logs.
   - Build Impact: No.
   - User Impact: Better logs to report in case of crashes and no errors while creating directories with depth more than 3.
   - Documentation: The code printing the logs also serve as section-wise docs.
   
   ## Testing
   
   I confirm that changes are verified on local setup and works as intended:
   
   - Build Host(s): OS (Linux), CPU(Intel), compiler(GCC 13).
   - Target(s): arch(sim), sim:mnemofs.
   
   
   Logs before:
   ```
   nsh> mkdir /hi/bye/die/lie
   binfs_stat: Entry
   mnemofs_mkdir: Mnemofs mkdir at bye/die/lie.
   mnemofs_mkdir: Lock acquired.
   ...
   mnemofs_mkdir: File exists.
   mfs_pitr_free: Pitr at depth 231216 with CTZ (21264, 231200) freed.
   mnemofs_mkdir: Lock released.
   mnemofs_mkdir: Mnemofs mkdir exited with ret -17.
   nsh: /hi/bye/die/lie: mkdir failed: 17
   ```
   
   Logs after:
   ```
   nsh> mkdir /hi/bye/die/lie
   binfs_stat: Entry
   mnemofs_mkdir: [mnemofs | MKDIR] Entry.
   mnemofs_mkdir: [mnemofs | MKDIR] New directory at "bye/die/lie".
   mnemofs_mkdir: [mnemofs | MKDIR] Mode is 0x41ff.
   mnemofs_mkdir: [mnemofs | MKDIR] Superblock is 0x512000000040.
   mnemofs_mkdir: [mnemofs | MKDIR] Mutex lock acquired.
   mfs_get_patharr: [mnemofs | MFS_GET_PATHARR] Entry.
   mfs_get_patharr: [mnemofs | MFS_GET_PATHARR] Relpath is "bye/die/lie".
   mfs_get_patharr: [mnemofs | MFS_GET_PATHARR] Path is 0x5310000386c0.
   mfs_get_patharr: [mnemofs | MFS_GET_PATHARR] There are 4 objects in path.
   mfs_get_patharr: [mnemofs | MFS_GET_PATHARR] Path array is allocated at 0x506000000320.
   next_child: [mnemofs | NEXT_CHILD] Requested string is "bye/die/lie" (0x502000000414),
   next_child: [mnemofs | NEXT_CHILD] Length is 3
   mfs_get_patharr: [mnemofs | MFS_GET_PATHARR] Root Master Node.
   mfs_get_patharr: [mnemofs | MFS_GET_PATHARR]    CTZ is (0, 432)
   mfs_get_patharr: [mnemofs | MFS_GET_PATHARR]    Size is 68
   mfs_get_patharr: [mnemofs | MFS_GET_PATHARR] Looking at depth 1
   mfs_get_patharr: [mnemofs | MFS_GET_PATHARR] Current String is "bye" (0x502000000414)
   mfs_get_patharr: [mnemofs | MFS_GET_PATHARR] Name length is 3
   mfs_get_patharr: [mnemofs | MFS_GET_PATHARR] Next String is "die/lie"
   mfs_hash: Hash calculated for size 3 to be 22722
   ...
   mnemofs_mkdir: [mnemofs | MKDIR] Direntry append successful.
   mnemofs_mkdir: [mnemofs | MKDIR]        Depth of parent 3.
   mnemofs_mkdir: [mnemofs | MKDIR]        Current iteration offset 0.
   mnemofs_mkdir: [mnemofs | MKDIR]        Parent's offset 0.
   mnemofs_mkdir: [mnemofs | MKDIR]        Parent's size 0.
   mnemofs_mkdir: [mnemofs | MKDIR]        Parent's CTZ (0, 0)
   mfs_pitr_free: Pitr at depth 3 with CTZ (0, 0) freed.
   mnemofs_mkdir: [mnemofs | MKDIR] Parent iterator freed.
   mnemofs_mkdir: [mnemofs | MKDIR] Directory created at "bye/die/lie".
   mnemofs_mkdir: [mnemofs | MKDIR] Path array freed.
   mnemofs_mkdir: [mnemofs | MKDIR] Mutex released.
   mnemofs_mkdir: [mnemofs | MKDIR] Exit | Return: 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-unsubscribe@nuttx.apache.org

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


Re: [PR] fs/mnemofs: Fix mkdir for depth > 3 bug, better logs [nuttx]

Posted by "nuttxpr (via GitHub)" <gi...@apache.org>.
nuttxpr commented on PR #14533:
URL: https://github.com/apache/nuttx/pull/14533#issuecomment-2441818404

   [**\[Experimental Bot, please feedback here\]**](https://github.com/search?q=repo%3Aapache%2Fnuttx+13552&type=issues)
   
   
   
   The PR provided generally meets the NuttX requirements with a few minor points for improvement:
   
   **Strengths:**
   
   * **Clear Summary:** The summary effectively outlines the "why," "what," and "how" of the changes. 
   * **Impact Section:**  Well-structured and addresses most key aspects. The detailed explanation of user impact is particularly good.
   * **Testing:** Provides pre- and post-change logs, demonstrating the bug fix and improved logging. It also specifies the testing environment.
   
   **Areas for Improvement:**
   
   * **Issue References:**  While it mentions a bug fix, it lacks a direct link to a corresponding NuttX issue. Always include issue links for traceability.
   * **Impact Specificity:** 
       * **Hardware:** Be more specific about the target architecture. "sim" suggests a simulator; specify which one (e.g., qemu-rv32).
       * **Security:**  Even if there's no impact, explicitly state "NO" for clarity.
       * **Compatibility:** Same as Security - be explicit even if there's no impact. 
   * **Testing Logs:** The logs are helpful, but consider trimming them to focus on the most relevant parts. Excessive length might hinder review.
   
   **Overall:** This PR is well on its way to meeting the NuttX requirements. Addressing the minor points above will further enhance its quality and facilitate a smoother review process. 
   


-- 
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


Re: [PR] fs/mnemofs: Fix mkdir for depth > 3 bug, better logs [nuttx]

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 merged PR #14533:
URL: https://github.com/apache/nuttx/pull/14533


-- 
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