CEPH-Devel archive mirror
 help / color / mirror / Atom feed
From: Ilya Dryomov <idryomov@gmail.com>
To: Xiubo Li <xiubli@redhat.com>
Cc: ceph-devel@vger.kernel.org, jlayton@kernel.org,
	vshankar@redhat.com,  mchangir@redhat.com
Subject: Re: [PATCH v3 3/3] libceph: just wait for more data to be available on the socket
Date: Mon, 22 Jan 2024 22:26:16 +0100	[thread overview]
Message-ID: <CAOi1vP9TZ6q5GQvN6Yi+E8xFSVGErFQNS30VB-QN4fi4tL77XQ@mail.gmail.com> (raw)
In-Reply-To: <CAOi1vP_Ht9xM=k5FvXEnjAOP0kvp_rebpz+ehvmGoaOZXgMhwQ@mail.gmail.com>

On Mon, Jan 22, 2024 at 8:13 PM Ilya Dryomov <idryomov@gmail.com> 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

      reply	other threads:[~2024-01-22 21:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-15  0:20 [PATCH v3 0/3] libceph: fix sparse-read failure bug xiubli
2023-12-15  0:20 ` [PATCH v3 1/3] libceph: fail the sparse-read if there still has data in socket xiubli
2023-12-15 17:06   ` Jeff Layton
2023-12-18  1:23     ` Xiubo Li
2023-12-15  0:20 ` [PATCH v3 2/3] libceph: rename read_sparse_msg_XX to read_partial_sparse_msg_XX xiubli
2023-12-15  0:20 ` [PATCH v3 3/3] libceph: just wait for more data to be available on the socket xiubli
2024-01-15 22:38   ` Ilya Dryomov
     [not found]     ` <a1d6e998-f496-4408-9d76-3671ee73e054@redhat.com>
2024-01-16 10:00       ` Ilya Dryomov
     [not found]         ` <35849fda-29b2-47ad-bf49-f2715efc7b8c@redhat.com>
2024-01-16 12:06           ` Ilya Dryomov
     [not found]         ` <68e4cf5a-f64f-4545-87b0-762ab920d9ba@redhat.com>
2024-01-22 19:13           ` Ilya Dryomov
2024-01-22 21:26             ` Ilya Dryomov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOi1vP9TZ6q5GQvN6Yi+E8xFSVGErFQNS30VB-QN4fi4tL77XQ@mail.gmail.com \
    --to=idryomov@gmail.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=jlayton@kernel.org \
    --cc=mchangir@redhat.com \
    --cc=vshankar@redhat.com \
    --cc=xiubli@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).