@@ -1084,7 +1084,7 @@ struct page *ceph_msg_data_next(struct ceph_msg_data_cursor *cursor,
* Returns true if the result moves the cursor on to the next piece
* of the data item.
*/
-void ceph_msg_data_advance(struct ceph_msg_data_cursor *cursor, size_t bytes)
+static void __ceph_msg_data_advance(struct ceph_msg_data_cursor *cursor, size_t bytes)
{
bool new_piece;
@@ -1120,6 +1120,16 @@ void ceph_msg_data_advance(struct ceph_msg_data_cursor *cursor, size_t bytes)
cursor->need_crc = new_piece;
}
+void ceph_msg_data_advance(struct ceph_msg_data_cursor *cursor, size_t bytes)
+{
+ while (bytes) {
+ size_t cur = min(bytes, PAGE_SIZE);
+
+ __ceph_msg_data_advance(cursor, cur);
+ bytes -= cur;
+ }
+}
+
u32 ceph_crc32c_page(u32 crc, struct page *page, unsigned int page_offset,
unsigned int length)
{
In later patches, we're going to need to advance deeper into the data buffer in order to set up for a sparse read. Rename the existing routine, and add a wrapper around it that successively calls it until it has advanced far enougb. Signed-off-by: Jeff Layton <jlayton@kernel.org> --- net/ceph/messenger.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)