summaryrefslogtreecommitdiff
path: root/fs/ceph/file.c
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2013-03-09 00:51:04 (GMT)
committerSage Weil <sage@inktank.com>2013-05-02 04:16:33 (GMT)
commite788182fa6c1a400076278a75d0efa0a8a08e4ec (patch)
treeae827f745b808a42c20761be12ac5bb435d109e9 /fs/ceph/file.c
parentb3d56fab333bbb3ac7300843d69e52d7bd8a016b (diff)
downloadlinux-fsl-qoriq-e788182fa6c1a400076278a75d0efa0a8a08e4ec.tar.xz
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 'fs/ceph/file.c')
0 files changed, 0 insertions, 0 deletions