OSDN Git Service

virtiofsd: get rid of in_sg_left variable
authorVivek Goyal <vgoyal@redhat.com>
Tue, 18 May 2021 21:35:35 +0000 (17:35 -0400)
committerDr. David Alan Gilbert <dgilbert@redhat.com>
Wed, 26 May 2021 17:39:32 +0000 (18:39 +0100)
commit0106f6f234d6361bb99cabfa48a953c929a3ca90
treeca2f6e6c9551b50a509e40aea5afbc847adeaa59
parent97dbfc5ae631724a2ae7f54de28c2f8e383b5980
virtiofsd: get rid of in_sg_left variable

in_sg_left seems to be being used primarly for debugging purpose. It is
keeping track of how many bytes are left in the scatter list we are
reading into.

We already have another variable "len" which keeps track how many bytes
are left to be read. And in_sg_left is greater than or equal to len. We
have already ensured that in the beginning of function.

    if (in_len < tosend_len) {
        fuse_log(FUSE_LOG_ERR, "%s: elem %d too small for data len %zd\n",
                 __func__, elem->index, tosend_len);
        ret = E2BIG;
        goto err;
    }

So in_sg_left seems like a redundant variable. It probably was useful for
debugging when code was being developed. Get rid of it. It helps simplify
this function.

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Connor Kuehl <ckuehl@redhat.com>
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Message-Id: <20210518213538.693422-5-vgoyal@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
tools/virtiofsd/fuse_virtio.c