diff options
author | Alex Elder <elder@inktank.com> | 2013-03-08 18:51:04 -0600 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-05-01 21:16:33 -0700 |
commit | e788182fa6c1a400076278a75d0efa0a8a08e4ec (patch) | |
tree | ae827f745b808a42c20761be12ac5bb435d109e9 /net/ceph/auth_x.h | |
parent | b3d56fab333bbb3ac7300843d69e52d7bd8a016b (diff) | |
download | blackbird-op-linux-e788182fa6c1a400076278a75d0efa0a8a08e4ec.tar.gz blackbird-op-linux-e788182fa6c1a400076278a75d0efa0a8a08e4ec.zip |
libceph: define and use in_msg_pos_next()
Define a new function in_msg_pos_next() to match out_msg_pos_next(),
and use it in place of code at the end of read_partial_message_pages()
and read_partial_message_bio().
Note that the page number is incremented and offset reset under
slightly different conditions from before. The result is
equivalent, however, as explained below.
Each time an incoming message is going to arrive, we find out how
much room is left--not surpassing the current page--and provide that
as the number of bytes to receive. So the amount we'll use is the
lesser of: all that's left of the entire request; and all that's
left in the current page.
If we received exactly how many were requested, we either reached
the end of the request or the end of the page. In the first case,
we're done, in the second, we move onto the next page in the array.
In all cases but (possibly) on the last page, after adding the
number of bytes received, page_pos == PAGE_SIZE. On the last page,
it doesn't really matter whether we increment the page number and
reset the page position, because we're done and we won't come back
here again. The code previously skipped over that last case,
basically. The new code handles that case the same as the others,
incrementing and resetting.
Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'net/ceph/auth_x.h')
0 files changed, 0 insertions, 0 deletions