Received: from eggs.gnu.org ([2001:4830:134:3::10]:45642) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wz5HM-0000JO-7w for qemu-devel@nongnu.org; Mon, 23 Jun 2014 10:31:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wz5HG-0003h9-BP for qemu-devel@nongnu.org; Mon, 23 Jun 2014 10:31:28 -0400 Received: from mx-v6.kamp.de ([2a02:248:0:51::16]:37858 helo=mx01.kamp.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wz5HG-0003gG-1i for qemu-devel@nongnu.org; Mon, 23 Jun 2014 10:31:22 -0400 From: Peter Lieven Date: Mon, 23 Jun 2014 16:30:36 +0200 Message-Id: <1403533836-28589-1-git-send-email-pl@kamp.de> Subject: [Qemu-devel] [PATCH] block/nfs: add knob to set readahead List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, pbonzini@redhat.com, Peter Lieven , ronniesahlberg@gmail.com, stefanha@redhat.com 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. Signed-off-by: Peter Lieven --- block/nfs.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/block/nfs.c b/block/nfs.c index ec43201..a5c0577 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)) { + if (!strcmp(qp->p[i].name, "uid")) { nfs_set_uid(client->context, atoi(qp->p[i].value)); - } else if (!strncmp(qp->p[i].name, "gid", 3)) { + } else if (!strcmp(qp->p[i].name, "gid")) { nfs_set_gid(client->context, atoi(qp->p[i].value)); - } else if (!strncmp(qp->p[i].name, "tcp-syncnt", 10)) { + } else if (!strcmp(qp->p[i].name, "tcp-syncnt")) { nfs_set_tcp_syncnt(client->context, atoi(qp->p[i].value)); +#ifdef LIBNFS_FEATURE_READAHEAD + } else if (!strcmp(qp->p[i].name, "readahead")) { + nfs_set_readahead(client->context, atoi(qp->p[i].value)); +#endif } else { error_setg(errp, "Unknown NFS parameter name: %s", qp->p[i].name); -- 1.7.9.5