nfs: add support for new libnfs API
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Mon, 9 Dec 2024 05:47:58 +0000 (15:47 +1000)
committerVincent Fu <vincent.fu@samsung.com>
Mon, 9 Dec 2024 15:44:15 +0000 (10:44 -0500)
New update of libnfs will have a new API that changes some signatures,
primarily in order to make nfs_[p]read[_async] calls
zero-copy in the sense that (almost) no data copy is done in the library
and READ3/READ4 payloads are read straigth from the socket into the
application buffer.

In-library zero-copy only works for !krb5 and !tls sessions but can provide
significant boost for read-intensive workloads when can be used.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Link: https://lore.kernel.org/r/20241209054758.3269700-1-ronniesahlberg@gmail.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
engines/nfs.c

index 6bc4af1fac76851c4498354bc643ea31bfcbca1a..13b55038ccccb6275f79f13d616cf609982a7591 100644 (file)
@@ -157,16 +157,28 @@ static int queue_write(struct fio_libnfs_options *o, struct io_u *io_u)
 {
        struct nfs_data *nfs_data = io_u->engine_data;
 
+#ifdef LIBNFS_API_V2
+       return nfs_pwrite_async(o->context, nfs_data->nfsfh,
+                               io_u->buf, io_u->buflen, io_u->offset,
+                               nfs_callback, io_u);
+#else
        return nfs_pwrite_async(o->context, nfs_data->nfsfh, io_u->offset,
                                io_u->buflen, io_u->buf, nfs_callback, io_u);
+#endif
 }
 
 static int queue_read(struct fio_libnfs_options *o, struct io_u *io_u)
 {
        struct nfs_data *nfs_data = io_u->engine_data;
 
+#ifdef LIBNFS_API_V2
+       return nfs_pread_async(o->context, nfs_data->nfsfh,
+                               io_u->buf, io_u->buflen, io_u->offset,
+                               nfs_callback, io_u);
+#else
        return nfs_pread_async(o->context, nfs_data->nfsfh, io_u->offset,
                                io_u->buflen, nfs_callback, io_u);
+#endif
 }
 
 static enum fio_q_status fio_libnfs_queue(struct thread_data *td,