Skip to content

Commit

Permalink
nfs: add support for new libnfs API
Browse files Browse the repository at this point in the history
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 <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Vincent Fu <[email protected]>
  • Loading branch information
sahlberg authored and vincentkfu committed Dec 9, 2024
1 parent 6f3de5c commit f512744
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions engines/nfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit f512744

Please sign in to comment.