Skip to content

Commit

Permalink
io_uring: move nop into its own file
Browse files Browse the repository at this point in the history
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
axboe committed Jul 25, 2022
1 parent 5e2a18d commit e28683b
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 15 deletions.
2 changes: 1 addition & 1 deletion io_uring/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
#
# Makefile for io_uring

obj-$(CONFIG_IO_URING) += io_uring.o xattr.o
obj-$(CONFIG_IO_URING) += io_uring.o xattr.o nop.o
obj-$(CONFIG_IO_WQ) += io-wq.o
15 changes: 1 addition & 14 deletions io_uring/io_uring.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
#include "io_uring.h"

#include "xattr.h"
#include "nop.h"

#define IORING_MAX_ENTRIES 32768
#define IORING_MAX_CQ_ENTRIES (2 * IORING_MAX_ENTRIES)
Expand Down Expand Up @@ -4298,20 +4299,6 @@ static int io_splice(struct io_kiocb *req, unsigned int issue_flags)
return IOU_OK;
}

static int io_nop_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
{
return 0;
}

/*
* IORING_OP_NOP just posts a completion event, nothing else.
*/
static int io_nop(struct io_kiocb *req, unsigned int issue_flags)
{
io_req_set_res(req, 0, 0);
return IOU_OK;
}

static int io_msg_ring_prep(struct io_kiocb *req,
const struct io_uring_sqe *sqe)
{
Expand Down
26 changes: 26 additions & 0 deletions io_uring/nop.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/fs.h>
#include <linux/file.h>
#include <linux/io_uring.h>

#include <uapi/linux/io_uring.h>

#include "io_uring_types.h"
#include "io_uring.h"
#include "nop.h"

int io_nop_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
{
return 0;
}

/*
* IORING_OP_NOP just posts a completion event, nothing else.
*/
int io_nop(struct io_kiocb *req, unsigned int issue_flags)
{
io_req_set_res(req, 0, 0);
return IOU_OK;
}
4 changes: 4 additions & 0 deletions io_uring/nop.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// SPDX-License-Identifier: GPL-2.0

int io_nop_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
int io_nop(struct io_kiocb *req, unsigned int issue_flags);

0 comments on commit e28683b

Please sign in to comment.