Skip to content

Use binary search for searching extent #42

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

Merged
merged 1 commit into from
Apr 24, 2024
Merged

Conversation

baekrang256
Copy link
Contributor

No description provided.

@jserv jserv requested a review from RoyWFHuang April 22, 2024 21:25
Copy link
Collaborator

@jserv jserv left a comment

Choose a reason for hiding this comment

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

Run clang-format -i for consistent style.

@baekrang256 baekrang256 requested a review from jserv April 23, 2024 03:47
Copy link
Collaborator

@jserv jserv left a comment

Choose a reason for hiding this comment

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

Use git rebase -i to squash the commits and read the article How to Write a Git Commit Message to refine the commit message.

@jserv jserv changed the title binary search implementation for simplefs_ext_search Use binary search for searching extent Apr 23, 2024
@baekrang256 baekrang256 force-pushed the master branch 2 times, most recently from e5fafce to 0f9f20c Compare April 23, 2024 07:54
@baekrang256 baekrang256 requested a review from jserv April 23, 2024 07:55
@RoyWFHuang
Copy link
Collaborator

These are some bugs in this function. I dump the kernel message and it shows:
[ 333.089632] BUG: unable to handle page fault for address: ffff94e6dcb34ff8
[ 333.099146] RIP: 0010:simplefs_ext_search.cold+0x46/0xa5 [simplefs]

By the information 0x46, we can find
46: 41 8b 78 04 mov 0x4(%r8),%edi
uint32_t len = index->extents[mid].ee_len;
it seems that the "mid" is out of range, so you may need to check when the "end" is 0 and assign to "boundary", which will make "end" reach to unsinged max

Another thing, you should also consider when the "end" is MAX_EXTENTS and ee_start != 0, this will also cause the same error.

@baekrang256
Copy link
Contributor Author

baekrang256 commented Apr 24, 2024

There were indeed some corner cases mentioned by @RoyWFHuang that was not handled. Thanks for the review.

I've fixed the code and tried the CI test in my local environment, checked the output comes out as expected according to other CI test outputs from other pr. I think you can try out the github action workflow again.

One additional question : should I rebase the branch again before the merge?

@jserv
Copy link
Collaborator

jserv commented Apr 24, 2024

One additional question : should I rebase the branch again before the merge?

Yes, please go ahead.

@baekrang256 baekrang256 force-pushed the master branch 2 times, most recently from e1e64db to 71f7340 Compare April 24, 2024 04:34
@baekrang256
Copy link
Contributor Author

Finished rebasing.

@jserv jserv merged commit b5d47c8 into sysprog21:master Apr 24, 2024
2 checks passed
@jserv
Copy link
Collaborator

jserv commented Apr 24, 2024

Thank @baekrang256 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.

3 participants