On Mon, Jan 22, 2024 at 8:13 PM Ilya Dryomov <idryomov@xxxxxxxxx> wrote: > I wouldn't object to cursor->sr_total_resid being added, I just don't > like it ;) Actually, how about just reusing cursor->sr_resid, which happens to be an int? Set it to -1 when con->ops->sparse_read() returns 0 and check for that at the top: struct ceph_msg_data_cursor *cursor = &con->in_msg->cursor; bool do_datacrc = !ceph_test_opt(from_msgr(con->msgr), NOCRC); u32 crc = 0; int ret = 1; if (cursor->sr_resid < 0) return 1; if (do_datacrc) crc = con->in_data_crc; [ ... no changes ... ] if (do_datacrc) con->in_data_crc = crc; if (ret < 0) return ret; cursor->sr_resid = -1; return 1; /* must return > 0 to indicate success */ Thanks, Ilya