From: Christian Schoenebeck <qemu_oss@crudebyte.com>
To: qemu-devel@nongnu.org
Cc: Greg Kurz <groug@kaod.org>
Subject: [PATCH v5 2/6] 9pfs readdir: rename max_count -> maxsize
Date: Thu, 26 Mar 2020 22:24:37 +0100 [thread overview]
Message-ID: <a8517fdd582e1b0be2a64f9a3504f18b3da0576a.1585258105.git.qemu_oss@crudebyte.com> (raw)
In-Reply-To: <cover.1585258105.git.qemu_oss@crudebyte.com>
Although the 9p protocol specs use the term 'max_count' as argument
for Treaddir, let's rename our variables for that to 'maxsize'
instead, because 'max_count' is semantically completely wrong. This
variable does not count integral entries, it is rather a maximum
size (in bytes) of the destination (response) buffer being filled.
Since this is just refactoring, hence this patch does not introduce
any behaviour change at all.
Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
---
hw/9pfs/9p.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
index 9e046f7acb..1aff4f1fa8 100644
--- a/hw/9pfs/9p.c
+++ b/hw/9pfs/9p.c
@@ -2162,7 +2162,7 @@ static int v9fs_xattr_read(V9fsState *s, V9fsPDU *pdu, V9fsFidState *fidp,
static int coroutine_fn v9fs_do_readdir_with_stat(V9fsPDU *pdu,
V9fsFidState *fidp,
- uint32_t max_count)
+ uint32_t maxsize)
{
V9fsPath path;
V9fsStat v9stat;
@@ -2199,7 +2199,7 @@ static int coroutine_fn v9fs_do_readdir_with_stat(V9fsPDU *pdu,
if (err < 0) {
break;
}
- if ((count + v9stat.size + 2) > max_count) {
+ if ((count + v9stat.size + 2) > maxsize) {
v9fs_readdir_unlock(&fidp->fs.dir);
/* Ran out of buffer. Set dir back to old position and return */
@@ -2332,7 +2332,7 @@ static size_t v9fs_readdir_data_size(V9fsString *name)
}
static int coroutine_fn v9fs_do_readdir(V9fsPDU *pdu, V9fsFidState *fidp,
- int32_t max_count)
+ int32_t maxsize)
{
size_t size;
V9fsQID qid;
@@ -2357,7 +2357,7 @@ static int coroutine_fn v9fs_do_readdir(V9fsPDU *pdu, V9fsFidState *fidp,
}
v9fs_string_init(&name);
v9fs_string_sprintf(&name, "%s", dent->d_name);
- if ((count + v9fs_readdir_data_size(&name)) > max_count) {
+ if ((count + v9fs_readdir_data_size(&name)) > maxsize) {
v9fs_readdir_unlock(&fidp->fs.dir);
/* Ran out of buffer. Set dir back to old position and return */
@@ -2432,20 +2432,20 @@ static void coroutine_fn v9fs_readdir(void *opaque)
size_t offset = 7;
uint64_t initial_offset;
int32_t count;
- uint32_t max_count;
+ uint32_t maxsize;
V9fsPDU *pdu = opaque;
V9fsState *s = pdu->s;
retval = pdu_unmarshal(pdu, offset, "dqd", &fid,
- &initial_offset, &max_count);
+ &initial_offset, &maxsize);
if (retval < 0) {
goto out_nofid;
}
- trace_v9fs_readdir(pdu->tag, pdu->id, fid, initial_offset, max_count);
+ trace_v9fs_readdir(pdu->tag, pdu->id, fid, initial_offset, maxsize);
/* Enough space for a R_readdir header: size[4] Rreaddir tag[2] count[4] */
- if (max_count > s->msize - 11) {
- max_count = s->msize - 11;
+ if (maxsize > s->msize - 11) {
+ maxsize = s->msize - 11;
warn_report_once(
"9p: bad client: T_readdir with count > msize - 11"
);
@@ -2465,7 +2465,7 @@ static void coroutine_fn v9fs_readdir(void *opaque)
} else {
v9fs_co_seekdir(pdu, fidp, initial_offset);
}
- count = v9fs_do_readdir(pdu, fidp, max_count);
+ count = v9fs_do_readdir(pdu, fidp, maxsize);
if (count < 0) {
retval = count;
goto out;
--
2.20.1
next prev parent reply other threads:[~2020-03-26 22:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-26 21:28 [PATCH v5 0/6] 9pfs: readdir optimization Christian Schoenebeck
2020-03-26 21:24 ` [PATCH v5 1/6] tests/virtio-9p: added split readdir tests Christian Schoenebeck
2020-03-26 21:24 ` Christian Schoenebeck [this message]
2020-03-26 21:24 ` [PATCH v5 3/6] 9pfs: make v9fs_readdir_response_size() public Christian Schoenebeck
2020-03-26 21:25 ` [PATCH v5 4/6] 9pfs: add new function v9fs_co_readdir_many() Christian Schoenebeck
2020-03-26 21:25 ` [PATCH v5 5/6] 9pfs: T_readdir latency optimization Christian Schoenebeck
2020-03-26 21:25 ` [PATCH v5 6/6] 9pfs: clarify latency of v9fs_co_run_in_worker() Christian Schoenebeck
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=a8517fdd582e1b0be2a64f9a3504f18b3da0576a.1585258105.git.qemu_oss@crudebyte.com \
--to=qemu_oss@crudebyte.com \
--cc=groug@kaod.org \
--cc=qemu-devel@nongnu.org \
/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 NNTP newsgroup(s).