From: Peter Lieven <pl@kamp.de>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, stefanha@redhat.com, Peter Lieven <pl@kamp.de>,
ronniesahlberg@gmail.com, pbonzini@redhat.com
Subject: [Qemu-devel] [PATCHv2] block/nfs: add knob to set readahead
Date: Tue, 24 Jun 2014 10:52:51 +0200 [thread overview]
Message-ID: <1403599971-9232-1-git-send-email-pl@kamp.de> (raw)
upcoming libnfs will feature internal readahead support.
Add a knob to pass the optional readahead value as a URL
parameter.
This patch fixes also the incorrect usage of strncmp and
atoi.
Signed-off-by: Peter Lieven <pl@kamp.de>
---
v1->v2: use strtol instead of atoi [Eric]
block/nfs.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/block/nfs.c b/block/nfs.c
index ec43201..9783483 100644
--- a/block/nfs.c
+++ b/block/nfs.c
@@ -309,12 +309,16 @@ static int64_t nfs_client_open(NFSClient *client, const char *filename,
qp->p[i].name);
goto fail;
}
- if (!strncmp(qp->p[i].name, "uid", 3)) {
- nfs_set_uid(client->context, atoi(qp->p[i].value));
- } else if (!strncmp(qp->p[i].name, "gid", 3)) {
- nfs_set_gid(client->context, atoi(qp->p[i].value));
- } else if (!strncmp(qp->p[i].name, "tcp-syncnt", 10)) {
- nfs_set_tcp_syncnt(client->context, atoi(qp->p[i].value));
+ if (!strcmp(qp->p[i].name, "uid")) {
+ nfs_set_uid(client->context, strtol(qp->p[i].value, NULL, 0));
+ } else if (!strcmp(qp->p[i].name, "gid")) {
+ nfs_set_gid(client->context, strtol(qp->p[i].value, NULL, 0));
+ } else if (!strcmp(qp->p[i].name, "tcp-syncnt")) {
+ nfs_set_tcp_syncnt(client->context, strtol(qp->p[i].value, NULL, 0));
+#ifdef LIBNFS_FEATURE_READAHEAD
+ } else if (!strcmp(qp->p[i].name, "readahead")) {
+ nfs_set_readahead(client->context, strtol(qp->p[i].value, NULL, 0));
+#endif
} else {
error_setg(errp, "Unknown NFS parameter name: %s",
qp->p[i].name);
--
1.7.9.5
next reply other threads:[~2014-06-24 8:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-24 8:52 Peter Lieven [this message]
2014-06-24 16:04 ` [Qemu-devel] [PATCHv2] block/nfs: add knob to set readahead Eric Blake
2014-06-24 21:48 ` Peter Lieven
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=1403599971-9232-1-git-send-email-pl@kamp.de \
--to=pl@kamp.de \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=ronniesahlberg@gmail.com \
--cc=stefanha@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.