Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
sys/vfs/hammer: Try to fix hammer_ioc_pfs_iterate() [1/2]
- The ioctl HAMMERIOC_PFS_ITERATE added in commit 29d31c2 has several design issues. This commit and the next one try to fix them. Since it's been exposed to userspace, some of them are left as it is with comments. - The name hammer_ioc_pfs_iterate::pos (pi->pos) is misleading. It should have been 'pfs_id'. Users will have no idea what the 'pos' is supposed to be. - pi->pos is unsigned. - Don't shift pi->pos (Don't ip localize pi->pos). Copy it to a local variable and then shift that. - cursor.key_end fields are necessary only when iterating btree. This function has 'iterate' in its name but all it does is a single btree lookup. - Don't |= HAMMER_PFSD_DELETED with pi->head.flags. pi->head.flags is for HAMMER_IOC_XXX macros, but not for ondisk pfs status (it was lucky PFSD_DELETED does not conflict with those values). Users get pfs status from cursor.data->pfsd.mirror_flags copied to userspace. libhammer code that is based on this wrong flag checking is fixed accordingly. - Check if pi->ondisk is allocated. - Copy ondisk pfs data regardless of ondisk pfs delete flag bit. The delete flag doesn't mean the data is gone.
- Loading branch information
Showing
3 changed files
with
24 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters