Re: [PATCH 1/7] nonblocking aio: Introduce IOCB_FLAG_NONBLOCKING

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Goldwyn Rodrigues <rgoldwyn@xxxxxxx> writes:

> From: Goldwyn Rodrigues <rgoldwyn@xxxxxxxx>
>
> This flag informs kernel to bail out if an AIO request will block
> for reasons such as file allocations, or a writeback triggered
> by direct I/O.
>
> IOCB_FLAG_NONBLOCKING is translated to IOCB_NONBLOCKING for
> iocb->ki_flags.

This shouldn't be an option, it should be the default.  This is what
users want when using this interface to begin with.

Cheers,
Jeff

>
> Signed-off-by: Goldwyn Rodrigues <rgoldwyn@xxxxxxxx>
> ---
>  fs/aio.c                     | 3 +++
>  include/linux/fs.h           | 1 +
>  include/uapi/linux/aio_abi.h | 3 +++
>  3 files changed, 7 insertions(+)
>
> diff --git a/fs/aio.c b/fs/aio.c
> index 428484f..0725756 100644
> --- a/fs/aio.c
> +++ b/fs/aio.c
> @@ -1551,6 +1551,9 @@ static int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb,
>  		req->common.ki_flags |= IOCB_EVENTFD;
>  	}
>  
> +	if (iocb->aio_flags & IOCB_FLAG_NONBLOCKING)
> +		req->common.ki_flags |= IOCB_NONBLOCKING;
> +
>  	ret = put_user(KIOCB_KEY, &user_iocb->aio_key);
>  	if (unlikely(ret)) {
>  		pr_debug("EFAULT: aio_key\n");
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index dc0478c..bfbaba6 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -322,6 +322,7 @@ struct writeback_control;
>  #define IOCB_DSYNC		(1 << 4)
>  #define IOCB_SYNC		(1 << 5)
>  #define IOCB_WRITE		(1 << 6)
> +#define IOCB_NONBLOCKING	(1 << 7)
>  
>  struct kiocb {
>  	struct file		*ki_filp;
> diff --git a/include/uapi/linux/aio_abi.h b/include/uapi/linux/aio_abi.h
> index bb2554f..03ce4c2 100644
> --- a/include/uapi/linux/aio_abi.h
> +++ b/include/uapi/linux/aio_abi.h
> @@ -51,8 +51,11 @@ enum {
>   *
>   * IOCB_FLAG_RESFD - Set if the "aio_resfd" member of the "struct iocb"
>   *                   is valid.
> + * IOCB_FLAG_NOBLOCK - Set if the user wants the iocb to fail if it would block
> + *			for operations such as disk allocation.
>   */
>  #define IOCB_FLAG_RESFD		(1 << 0)
> +#define IOCB_FLAG_NONBLOCKING	(1 << 1)
>  
>  /* read() from /dev/aio returns these structures. */
>  struct io_event {



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux