virtiofsd: Simplify skip byte logic
commitbf7a3ee04430dfe426eacf6ee587e2a069ba67ce
authorVivek Goyal <vgoyal@redhat.com>
Tue, 18 May 2021 21:35:36 +0000 (18 17:35 -0400)
committerDr. David Alan Gilbert <dgilbert@redhat.com>
Wed, 26 May 2021 17:39:32 +0000 (26 18:39 +0100)
treebc1125995730bf3524518502235c199b9e15b22b
parent0106f6f234d6361bb99cabfa48a953c929a3ca90
virtiofsd: Simplify skip byte logic

We need to skip bytes in two cases.

a. Before we start reading into in_sg, we need to skip iov_len bytes
   in the beginning which typically will have fuse_out_header.

b. If preadv() does a short read, then we need to retry preadv() with
   remainig bytes and skip the bytes preadv() read in short read.

For case a, there is no reason that skipping logic be inside the while
loop. Move it outside. And only retain logic "b" inside while loop.

Also get rid of variable "skip_size". Looks like we can do without it.

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-6-vgoyal@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
tools/virtiofsd/fuse_virtio.c