Make fsck(8) use pread(2). This cuts the number of syscalls by half.
Details
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 21224 Build 20570: arc lint + arc unit
Event Timeline
In answer to kib:
The callers do not depend on the seek offset being set after the call.
The other three places in fsutil.c that do lseek followed by read/write (error followup in blread and blwrite along with blzero) should also be changed to use pread/pwrite.
The reason I hadn't changed the other instances is that while trivial, they are somewhat harder to test, and I've been bitten by trivial changes to rarely excercised branches in the past.
I prefer not to do things halfway. Either we use lseek/read or we use pread. Having it half & half is just crappy coding style. It is possible to write some tests that will exercise the error cases, so if you want to make this change, then I would like you to do it completely.
sbin/fsck_ffs/fsutil.c | ||
---|---|---|
573 | Thanks for suggestion; see https://reviews.freebsd.org/D18570. It adds errno reporting to the normal path, in the other 'if' branch. |