Skip to content

Conversation

RoyWFHuang
Copy link
Collaborator

@RoyWFHuang RoyWFHuang commented Jul 21, 2025

Inspired by Ext4's rec_len, add nr_blk in struct simplefs_file to record how many contiguous blocks a file occupies. This method quickly locate the next available block for storing new file data.

Additionally, it improves the removal process in directories — by setting the inode to 0 and merging block information with the previous entry

there is the test data:

remove 30600 files

  • legacy:
    24855.97 msec task-clock # 0.965 CPUs utilized
    6809 context-switches # 273.938 /sec
    9 cpu-migrations # 0.362 /sec
    2287 page-faults # 92.010 /sec
    58198042110 cycles # 2.341 GHz
    45389686010 instructions # 0.78 insn per cycle
    10407138113 branches # 418.698 M/sec
    18144553 branch-misses # 0.17% of all branches

    25.746234000 seconds time elapsed
     0.143492000 seconds user
    24.560907000 seconds sys
    
  • like ext4
    13845.94 msec task-clock # 1.000 CPUs utilized
    68 context-switches # 4.911 /sec
    0 cpu-migrations # 0.000 /sec
    2285 page-faults # 165.030 /sec
    34152461876 cycles # 2.467 GHz
    41149033388 instructions # 1.20 insn per cycle
    9555245488 branches # 690.112 M/sec
    5952012 branch-misses # 0.06% of all branches

    13.852185875 seconds time elapsed
     0.074034000 seconds user
    13.774539000 seconds sys
    

close #63

@jserv jserv requested a review from HotMercury July 22, 2025 03:50
@jserv
Copy link
Collaborator

jserv commented Jul 22, 2025

This patch looks great. Can you write down the known limitations as well?

@RoyWFHuang
Copy link
Collaborator Author

ok, give me some time to summarize

@RoyWFHuang RoyWFHuang force-pushed the Feature/directory_arch branch 4 times, most recently from 1ebb930 to 3f343ee Compare July 27, 2025 12:42
@RoyWFHuang
Copy link
Collaborator Author

I don't think there are any additional restrictions. Same as old version.
Here are some conclusions about this change:

  1. The maximum number of files allowed per directory is reduced to 30,600 (for 200 M image file)
  2. Listing operation is slower compared to the legacy method
  3. Creating operation is slower compared to the legacy method

Here is the performance test result:
https://hackmd.io/@royhuang/Boost_ext_blk_access#Test-the-performance

Add nr_blk in struct simiplefs_file to record the number of contiguous
blocks a file occupies, similar to ext4's rec_len. This speeds up
finding free blocks and optimizes file removal by merging freed space
with the previous entry.
@RoyWFHuang RoyWFHuang force-pushed the Feature/directory_arch branch from 3f343ee to 0c50fb5 Compare July 27, 2025 13:17
@jserv jserv merged commit a9477a6 into sysprog21:master Jul 27, 2025
2 checks passed
@jserv
Copy link
Collaborator

jserv commented Jul 27, 2025

Thank @RoyWFHuang for contributing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Redesign file deletion process in simplefs
2 participants