Skip to content

Conversation

@RoyWFHuang
Copy link
Collaborator

@RoyWFHuang RoyWFHuang commented Nov 10, 2025

Previously, SimpleFS used a sequential insertion method to create files, which worked efficiently when the filesystem contained only a small number of files.
However, in real-world use cases, filesystems often manage a large number of files, making sequential search and insertion inefficient.
Inspired by Ext4’s hash-based directory indexing, this change adopts a hash function to accelerate file indexing and improve scalability.

Change:
Implemented hash-based file index lookup
Improved scalability for large directory structures

hash_code = file_hash(file_name);

extent index = hash_code / SIMPLEFS_MAX_BLOCKS_PER_EXTENT
block index = hash_code % SIMPLEFS_MAX_BLOCKS_PER_EXTENT;

 inode
  +-----------------------+
  | i_mode = IFDIR | 0755 |      block 123 (simplefs_file_ei_block)
  | ei_block = 123    ----|--->  +----------------+
  | i_size = 4 KiB        |      | nr_files  = 7  |
  | i_blocks = 1          |      |----------------|
  +-----------------------+    0 | ee_block  = 0  |
              (extent index = 0) | ee_len    = 8  |
                                 | ee_start  = 84 |--->  +-------------+ block 84(simplefs_dir_block)
                                 | nr_file   = 2  |      |nr_files = 2 | (block index = 0)
                                 |----------------|      |-------------|
                               1 | ee_block  = 8  |    0 | inode  = 24 |
              (extent index = 1) | ee_len    = 8  |      | nr_blk = 1  |
                                 | ee_start  = 16 |      | (foo)       |
                                 | nr_file   = 5  |      |-------------|
                                 |----------------|    1 | inode  = 45 |
                                 | ...            |      | nr_blk = 14 |
                                 |----------------|      | (bar)       |
                             341 | ee_block  = 0  |      |-------------|
            (extent index = 341) | ee_len    = 0  |      | ...         |
                                 | ee_start  = 0  |      |-------------|
                                 | nr_file   = 12 |   14 | 0           |
                                 +----------------+      +-------------+ block 85(simplefs_dir_block)
                                                         |nr_files = 2 | (block index = 1)
                                                         |-------------|
                                                       0 | inode  = 48 |
                                                         | nr_blk = 15 |
                                                         | (foo1)      |
                                                         |-------------|
                                                       1 | inode  = 0  |
                                                         | nr_blk = 0  |
                                                         |             |
                                                         |-------------|
                                                         | ...         |
                                                         |-------------|
                                                      14 | 0           |
                                                         +-------------+

Performance test

  • Random create 30600 files into filesystem

legacy:

         168140.12 msec task-clock                       #    0.647 CPUs utilized
            111367      context-switches                 #  662.346 /sec
             40917      cpu-migrations                   #  243.351 /sec
           3736053      page-faults                      #   22.220 K/sec
      369091680702      cycles                           #    2.195 GHz
      168751830643      instructions                     #    0.46  insn per cycle
       34044524391      branches                         #  202.477 M/sec
         768151711      branch-misses                    #    2.26% of all branches

     259.842753513 seconds time elapsed
      23.000247000 seconds user
     150.380145000 seconds sys

full_name_hash

         167926.13 msec task-clock                       #    0.755 CPUs utilized
            110631      context-switches                 #  658.808 /sec
             43835      cpu-migrations                   #  261.037 /sec
           3858617      page-faults                      #   22.978 K/sec
      392878398961      cycles                           #    2.340 GHz
      207287412692      instructions                     #    0.53  insn per cycle
       42556269864      branches                         #  253.423 M/sec
         840868990      branch-misses                    #    1.98% of all branches

     222.274028604 seconds time elapsed
      20.794966000 seconds user
     151.941876000 seconds sys

  • Random remove 30600 files into filesystem

legacy:

         104332.44 msec task-clock                       #    0.976 CPUs utilized
             56514      context-switches                 #  541.672 /sec
              1174      cpu-migrations                   #   11.252 /sec
           3796962      page-faults                      #   36.393 K/sec
      258293481279      cycles                           #    2.476 GHz
      153853176926      instructions                     #    0.60  insn per cycle
       30434271757      branches                         #  291.705 M/sec
         532967347      branch-misses                    #    1.75% of all branches

     106.921706288 seconds time elapsed
      16.987883000 seconds user
      91.268661000 seconds sys

full_name_hash

          83278.61 msec task-clock                       #    0.967 CPUs utilized
             52431      context-switches                 #  629.585 /sec
              1309      cpu-migrations                   #   15.718 /sec
           3796501      page-faults                      #   45.588 K/sec
      199894058328      cycles                           #    2.400 GHz
      110625460371      instructions                     #    0.55  insn per cycle
       20325767251      branches                         #  244.069 M/sec
         490549944      branch-misses                    #    2.41% of all branches

      86.132655220 seconds time elapsed
      19.180209000 seconds user
      68.476075000 seconds sys
  • Random check (ls -la filename) 30600 files into filesystem
    Use perf stat ls -la to measure the query time for each file and sum up all elapsed times to calculate the total lookup cost.

Legacy :
min time: 0.00171 s
max time: 0.03799 s
avg time: 0.00423332 s
tot time: 129.539510 s

full_name_hash:
min time: 0.00171 s
max time: 0.03588 s
avg time: 0.00305601 s
tot time: 93.514040 s


Summary by cubic

Switched SimpleFS to hash-based directory indexing using full_name_hash to speed up file creation and lookup by mapping filenames to extent/block slots. On 30.6k files: create ~33% faster, delete ~12% faster, lookup ~41% faster.

  • New Features

    • Hash-guided placement/lookup in create, link, symlink, rename, and unlink.
    • Added fast __file_lookup and early-stop iteration using per-extent counts; reclaims empty extents on unlink/rename.
  • Refactors

    • Added hash.c (simplefs_hash via full_name_hash).

Written for commit 304f288. Summary will update automatically on new commits.

@jserv
Copy link
Collaborator

jserv commented Nov 10, 2025

How can you determine which hash function is the most suitable?

cubic-dev-ai[bot]

This comment was marked as resolved.

Copy link
Contributor

@visitorckw visitorckw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw that your PR description includes some performance benchmarks, but the commit message lacks any performance numbers to support your improvements. Please improve the commit message.

@RoyWFHuang
Copy link
Collaborator Author

How can you determine which hash function is the most suitable?

I’m not sure if "fnv" is the most suitable, but index in SimpleFS is relatively small, using a more complex algorithm might not provide significant benefits. I think fnv is a reasonable balance between simplicity and performance.

@RoyWFHuang RoyWFHuang force-pushed the feature/op_perf branch 2 times, most recently from ca74c03 to 51e0478 Compare November 10, 2025 21:54
Copy link
Contributor

@visitorckw visitorckw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You ignored many of my comments without making any changes or providing any replies. You still retained many irrelevant changes, making the review difficult. Additionally, a single-line commit message saying only "optimize the file search process" is way too vague. Please improve the git commit message.

@RoyWFHuang RoyWFHuang force-pushed the feature/op_perf branch 2 times, most recently from 0519d61 to 864a9a1 Compare November 13, 2025 21:21
@RoyWFHuang
Copy link
Collaborator Author

I saw that your PR description includes some performance benchmarks, but the commit message lacks any performance numbers to support your improvements. Please improve the commit message.

Added all hash results into the commit.

@RoyWFHuang RoyWFHuang force-pushed the feature/op_perf branch 2 times, most recently from 56c0522 to 0176a4b Compare November 14, 2025 17:38
Copy link
Contributor

@visitorckw visitorckw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quoted from patch 2:

Align the print function with the Simplefs print format for consistency.
Also adjust variable declarations to fix compiler warnings when building
under the C90 standard.

I'm unsure which Linux kernel versions simplefs currently intends to support, but AFAIK, the Linux kernel currently uses gnu c11 as its standard.

Furthermore, the word "Also" is often a sign that the change should be in a separate patch. In my view, you are performing two distinct actions here:

a) Changing printk -> pr_err.
b) Fixing a compiler warning.

I also remain confused as to whether the printk to pr_err change is truly warranted, and what relevance it has to the PR's title, which is "Use hash func to boost file creation and lookup".

@RoyWFHuang RoyWFHuang force-pushed the feature/op_perf branch 2 times, most recently from 211edce to d02e46a Compare November 16, 2025 03:06
@visitorckw
Copy link
Contributor

Hmmm, I see my comments were marked as resolved, but I don't see any changes or replies. Since you re-requested a review, did you perhaps forget to push the new changes, or am I missing something?

@RoyWFHuang
Copy link
Collaborator Author

Hmmm, I see my comments were marked as resolved, but I don't see any changes or replies. Since you re-requested a review, did you perhaps forget to push the new changes, or am I missing something?

I replied to the comments to clarify why I added ei_nr and why I am still using simplefs_hash. Could you please help check it?

@visitorckw
Copy link
Contributor

I checked my email and didn't see any replies between the two review requests. I also checked the gihub web page and expanded the 'show resolved' threads on my last two comments, but I still don't see a response there. t seems like somehow your reply didn't go through, or maybe I just can't see it on my end?

@RoyWFHuang
Copy link
Collaborator Author

RoyWFHuang commented Nov 22, 2025

I checked my email and didn't see any replies between the two review requests. I also checked the gihub web page and expanded the 'show resolved' threads on my last two comments, but I still don't see a response there. t seems like somehow your reply didn't go through, or maybe I just can't see it on my end?

Sorry, I forgot to submit these comments


for (idx_ei = 0; idx_ei < SIMPLEFS_MAX_EXTENTS; _ei++, idx_ei++) {
if (unlikely(_ei >= SIMPLEFS_MAX_EXTENTS))
_ei %= SIMPLEFS_MAX_EXTENTS;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The wraparound search (_ei %= SIMPLEFS_MAX_EXTENTS) handles collisions, but the worst case is still O(n) if many files hash to the same bucket.

Consider documenting expected collision rates with your benchmark files.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pattern repeats 6+ times. A helper function would reduce the 300+ line.

jserv

This comment was marked as resolved.

Each `simplefs_extent` structure contains a counter that records the
total number of files within that extent. When the counter matches the
expected file number, it indicates there are no more files after this
index, allowing the iterator to skip directly to the next extension block.
This reduces unnecessary scanning and improves traversal efficiency.
@RoyWFHuang RoyWFHuang force-pushed the feature/op_perf branch 2 times, most recently from bb3ff57 to cebc007 Compare November 27, 2025 21:30
Introduce a hash-based mechanism to speed up file creation and lookup
operations. The hash function enables faster access to extent and logical
block extent index, improving overall filesystem performance.

hash_code = file_hash(file_name);
extent index = hash_code / SIMPLEFS_MAX_BLOCKS_PER_EXTENT
block index = hash_code % SIMPLEFS_MAX_BLOCKS_PER_EXTENT;

Use perf to measure:
1. File Creation (random)
Legacy:
259.842753513 seconds time elapsed
23.000247000 seconds user
150.380145000 seconds sys

full_name_hash:
222.274028604 seconds time elapsed
20.794966000 seconds user
151.941876000 seconds sys

2. File Listing (random)
Legacy:
min time: 0.00171 s
max time: 0.03799 s
avg time: 0.00423332 s
tot time: 129.539510 s

full_name_hash:
min time: 0.00171 s
max time: 0.03588 s
avg time: 0.00305601 s
tot time: 93.514040 s

3. files Removal (Random)
Legacy:
106.921706288 seconds time elapsed
16.987883000 seconds user
91.268661000 seconds sys

full_name_hash:
86.132655220 seconds time elapsed
19.180209000 seconds user
68.476075000 seconds sys
@sysprog21 sysprog21 deleted a comment from cubic-dev-ai bot Nov 28, 2025
@sysprog21 sysprog21 deleted a comment from cubic-dev-ai bot Nov 28, 2025
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 issues found across 5 files

Prompt for AI agents (all 3 issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="inode.c">

<violation number="1" location="inode.c:742">
Clearing an empty extent in unlink never marks the parent directory block dirty (and the buffer is leaked), so the reclaimed extent is not persisted and can lead to metadata corruption.</violation>

<violation number="2" location="inode.c:900">
Rename now fails for directories that are already full, even when the rename occurs within the same directory and should succeed.</violation>

<violation number="3" location="inode.c:957">
bh_fei_blk_src acquired during rename is never released, leaking a buffer_head and pinning the source directory block.</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

goto rm_new;

/* if extent[i] file number is 0, reclaim the extent[i] block*/
bh_fei_blk_src = sb_bread(sb, ci_src->ei_block);
Copy link

@cubic-dev-ai cubic-dev-ai bot Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bh_fei_blk_src acquired during rename is never released, leaking a buffer_head and pinning the source directory block.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At inode.c, line 957:

<comment>bh_fei_blk_src acquired during rename is never released, leaking a buffer_head and pinning the source directory block.</comment>

<file context>
@@ -753,186 +833,187 @@ static int simplefs_unlink(struct inode *dir, struct dentry *dentry)
+        goto rm_new;
+
+    /* if extent[i] file number is 0, reclaim the extent[i] block*/
+    bh_fei_blk_src = sb_bread(sb, ci_src-&gt;ei_block);
+    if (!bh_fei_blk_src) {
+        ret = -EIO;
</file context>
Fix with Cubic


/* If new directory is full, fail */
if (new_pos < 0 && eblock_new->nr_files == SIMPLEFS_FILES_PER_EXT) {
if (eblk_dest->nr_files == SIMPLEFS_MAX_SUBFILES) {
Copy link

@cubic-dev-ai cubic-dev-ai bot Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename now fails for directories that are already full, even when the rename occurs within the same directory and should succeed.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At inode.c, line 900:

<comment>Rename now fails for directories that are already full, even when the rename occurs within the same directory and should succeed.</comment>

<file context>
@@ -753,186 +833,187 @@ static int simplefs_unlink(struct inode *dir, struct dentry *dentry)
+
     /* If new directory is full, fail */
-    if (new_pos &lt; 0 &amp;&amp; eblock_new-&gt;nr_files == SIMPLEFS_FILES_PER_EXT) {
+    if (eblk_dest-&gt;nr_files == SIMPLEFS_MAX_SUBFILES) {
         ret = -EMLINK;
         goto release_new;
</file context>
Suggested change
if (eblk_dest->nr_files == SIMPLEFS_MAX_SUBFILES) {
if (dest_dir != src_dir && eblk_dest->nr_files == SIMPLEFS_MAX_SUBFILES) {
Fix with Cubic

eblk = (struct simplefs_file_ei_block *) bh->b_data;
if (!eblk->extents[ei].nr_files) {
put_blocks(sbi, eblk->extents[ei].ee_start, eblk->extents[ei].ee_len);
memset(&eblk->extents[ei], 0, sizeof(struct simplefs_extent));
Copy link

@cubic-dev-ai cubic-dev-ai bot Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clearing an empty extent in unlink never marks the parent directory block dirty (and the buffer is leaked), so the reclaimed extent is not persisted and can lead to metadata corruption.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At inode.c, line 742:

<comment>Clearing an empty extent in unlink never marks the parent directory block dirty (and the buffer is leaked), so the reclaimed extent is not persisted and can lead to metadata corruption.</comment>

<file context>
@@ -656,9 +727,20 @@ static int simplefs_unlink(struct inode *dir, struct dentry *dentry)
+    eblk = (struct simplefs_file_ei_block *) bh-&gt;b_data;
+    if (!eblk-&gt;extents[ei].nr_files) {
+        put_blocks(sbi, eblk-&gt;extents[ei].ee_start, eblk-&gt;extents[ei].ee_len);
+        memset(&amp;eblk-&gt;extents[ei], 0, sizeof(struct simplefs_extent));
+    }
 
</file context>
Fix with Cubic

Comment on lines +214 to +221
bh = sb_bread(sb, ci_dir->ei_block);
if (!bh)
return ERR_PTR(-EIO);

eblock = (struct simplefs_file_ei_block *) bh->b_data;
bh2 = sb_bread(sb, eblock->extents[ei].ee_start + bi);
if (!bh2)
return ERR_PTR(-EIO);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Buffer head leak in simplefs_lookup(): When bh2 read fails, bh is never released.

goto release_new;

rm_new:
simplefs_remove_from_dir(dest_dir, dest_dentry, &dest_ei);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dest_dentry was never inserted - it has no inode. simplefs_remove_from_dir() calls d_inode(dentry) unconditionally. Kernel panic on any rename
error after simplefs_put_new_ext().

Comment on lines +135 to +136
hash_code = simplefs_hash(dentry) %
(SIMPLEFS_MAX_EXTENTS * SIMPLEFS_MAX_BLOCKS_PER_EXTENT);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

full_name_hash() is designed for VFS dentry caching, not for on-disk indexing. It uses a per-boot salt that changes on reboot. Consider: what happens to hash placement after reboot?

If full_name_hash() returns different values after reboot (it does), lookups will start from wrong positions. The linear probe fallback saves correctness, but destroys the performance benefit.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a deterministic hash like FNV-1a or djb2.

@jserv
Copy link
Collaborator

jserv commented Nov 28, 2025

@cubic-dev-ai Continue analyzing and warning until:

  1. Fix all buffer head leaks
  2. Add missing mark_buffer_dirty() calls
  3. Fix the rename error path panic
  4. Extract wraparound logic into helper function

@sysprog21 sysprog21 deleted a comment from cubic-dev-ai bot Nov 28, 2025
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 issues found across 5 files

Prompt for AI agents (all 4 issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="inode.c">

<violation number="1" location="inode.c:735">
The buffer head fetched for the parent directory in unlink is never brelse’d before bh is reused, so every unlink leaks a buffer and can leave it pinned on error paths.</violation>

<violation number="2" location="inode.c:742">
After freeing an empty extent in unlink, the code zeros the extent fields but never marks the buffer dirty, so the on-disk directory index still references the freed blocks.</violation>

<violation number="3" location="inode.c:957">
The source directory extent buffer acquired in rename (bh_fei_blk_src) is never released, leading to a persistent buffer-head leak for every cross-directory rename.</violation>

<violation number="4" location="inode.c:1006">
Rolling back a failed rename calls simplefs_remove_from_dir on dest_dentry even though it has no inode, causing simplefs_remove_from_dir to dereference NULL and crash.</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

goto rm_new;

/* if extent[i] file number is 0, reclaim the extent[i] block*/
bh_fei_blk_src = sb_bread(sb, ci_src->ei_block);
Copy link

@cubic-dev-ai cubic-dev-ai bot Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The source directory extent buffer acquired in rename (bh_fei_blk_src) is never released, leading to a persistent buffer-head leak for every cross-directory rename.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At inode.c, line 957:

<comment>The source directory extent buffer acquired in rename (bh_fei_blk_src) is never released, leading to a persistent buffer-head leak for every cross-directory rename.</comment>

<file context>
@@ -753,186 +833,187 @@ static int simplefs_unlink(struct inode *dir, struct dentry *dentry)
+        goto rm_new;
+
+    /* if extent[i] file number is 0, reclaim the extent[i] block*/
+    bh_fei_blk_src = sb_bread(sb, ci_src-&gt;ei_block);
+    if (!bh_fei_blk_src) {
+        ret = -EIO;
</file context>
Fix with Cubic

if (ret != 0)
return ret;
/* if extent[i] file number is 0, reclaim the extent[i] block*/
bh = sb_bread(sb, SIMPLEFS_INODE(dir)->ei_block);
Copy link

@cubic-dev-ai cubic-dev-ai bot Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The buffer head fetched for the parent directory in unlink is never brelse’d before bh is reused, so every unlink leaks a buffer and can leave it pinned on error paths.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At inode.c, line 735:

<comment>The buffer head fetched for the parent directory in unlink is never brelse’d before bh is reused, so every unlink leaks a buffer and can leave it pinned on error paths.</comment>

<file context>
@@ -656,9 +727,20 @@ static int simplefs_unlink(struct inode *dir, struct dentry *dentry)
     if (ret != 0)
         return ret;
+    /* if extent[i] file number is 0, reclaim the extent[i] block*/
+    bh = sb_bread(sb, SIMPLEFS_INODE(dir)-&gt;ei_block);
+    if (!bh)
+        return -EIO;
</file context>
Fix with Cubic

goto release_new;

rm_new:
simplefs_remove_from_dir(dest_dir, dest_dentry, &dest_ei);
Copy link

@cubic-dev-ai cubic-dev-ai bot Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rolling back a failed rename calls simplefs_remove_from_dir on dest_dentry even though it has no inode, causing simplefs_remove_from_dir to dereference NULL and crash.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At inode.c, line 1006:

<comment>Rolling back a failed rename calls simplefs_remove_from_dir on dest_dentry even though it has no inode, causing simplefs_remove_from_dir to dereference NULL and crash.</comment>

<file context>
@@ -753,186 +833,187 @@ static int simplefs_unlink(struct inode *dir, struct dentry *dentry)
+    goto release_new;
+
+rm_new:
+    simplefs_remove_from_dir(dest_dir, dest_dentry, &amp;dest_ei);
 
 put_block:
</file context>
Fix with Cubic

eblk = (struct simplefs_file_ei_block *) bh->b_data;
if (!eblk->extents[ei].nr_files) {
put_blocks(sbi, eblk->extents[ei].ee_start, eblk->extents[ei].ee_len);
memset(&eblk->extents[ei], 0, sizeof(struct simplefs_extent));
Copy link

@cubic-dev-ai cubic-dev-ai bot Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After freeing an empty extent in unlink, the code zeros the extent fields but never marks the buffer dirty, so the on-disk directory index still references the freed blocks.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At inode.c, line 742:

<comment>After freeing an empty extent in unlink, the code zeros the extent fields but never marks the buffer dirty, so the on-disk directory index still references the freed blocks.</comment>

<file context>
@@ -656,9 +727,20 @@ static int simplefs_unlink(struct inode *dir, struct dentry *dentry)
+    eblk = (struct simplefs_file_ei_block *) bh-&gt;b_data;
+    if (!eblk-&gt;extents[ei].nr_files) {
+        put_blocks(sbi, eblk-&gt;extents[ei].ee_start, eblk-&gt;extents[ei].ee_len);
+        memset(&amp;eblk-&gt;extents[ei], 0, sizeof(struct simplefs_extent));
+    }
 
</file context>
Fix with Cubic

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.

3 participants