On Wed, 14 Oct 2009, Christoph Hellwig wrote:
It seems like the more elegant approach would be to set offset before the
first read, and then update it if the first read takes place (in case it
unaligned). That also gets rid of bufaddr, and seems like it might read
Yeah. Note that in Linux 2.6.29 I did some changes in that are to
take the read and offset calculation into a common helper
Looking at the improved code since 2.6.29, and assuming that the beginning of
the log will always be aligned, I have come up with the attached patch against
18.104.22.168. I think it's cleaner, and it passes my tests.
The bufaddr variable is no longer needed. I removed the xlog_align() after
the second read for both headers and data since the second read will always be
aligned (even if there was no first read) since it is always at the beginning
of the log.
It sets offset to the beginning of the buffer with XFS_BUF_PTR() before the
first read, and then your improved xlog_bread() will update the offset if the
first read had to be re-aligned.
What do you think?
It ain't what you don't know that gets you into trouble.
It's what you know for sure that just ain't so. - Mark Twain