-
Notifications
You must be signed in to change notification settings - Fork 104
Use hash func to boost file creation and lookup #79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -62,9 +62,10 @@ static int simplefs_iterate(struct file *dir, struct dir_context *ctx) | |
| for (; remained_nr_files && ei < SIMPLEFS_MAX_EXTENTS; ei++) { | ||
| if (eblock->extents[ei].ee_start == 0) | ||
| continue; | ||
|
|
||
| int ei_nr = eblock->extents[ei].nr_files; | ||
| /* Iterate over blocks in one extent */ | ||
| for (bi = 0; bi < eblock->extents[ei].ee_len && remained_nr_files; | ||
| for (bi = 0; | ||
| bi < eblock->extents[ei].ee_len && remained_nr_files && ei_nr; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How often does ei_nr actually hit 0 during the loop check? Is the overhead of maintaining ei_nr really justified by the benefit of terminating the loop early?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. full_name_hash in remove file full_name_hash in list single file remove ei_nr: |
||
| bi++) { | ||
| bh2 = sb_bread(sb, eblock->extents[ei].ee_start + bi); | ||
| if (!bh2) { | ||
|
|
@@ -80,12 +81,13 @@ static int simplefs_iterate(struct file *dir, struct dir_context *ctx) | |
| continue; | ||
| } | ||
|
|
||
| for (fi = 0; fi < SIMPLEFS_FILES_PER_BLOCK;) { | ||
| for (fi = 0; fi < SIMPLEFS_FILES_PER_BLOCK && dblock->nr_files;) { | ||
| if (dblock->files[fi].inode != 0) { | ||
| if (offset) { | ||
| offset--; | ||
| } else { | ||
| remained_nr_files--; | ||
| ei_nr--; | ||
| if (!dir_emit(ctx, dblock->files[fi].filename, | ||
| SIMPLEFS_FILENAME_LEN, | ||
| dblock->files[fi].inode, DT_UNKNOWN)) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| #include <linux/stringhash.h> | ||
| #include <linux/types.h> | ||
| #include "simplefs.h" | ||
|
|
||
| uint32_t simplefs_hash(struct dentry *dentry) | ||
| { | ||
| return full_name_hash(dentry, dentry->d_name.name, | ||
| strlen(dentry->d_name.name)); | ||
| } | ||
RoyWFHuang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Uh oh!
There was an error while loading. Please reload this page.