[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170418113902.GS4781@twin.jikos.cz>
Date: Tue, 18 Apr 2017 13:39:02 +0200
From: David Sterba <dsterba@...e.cz>
To: Goldwyn Rodrigues <rgoldwyn@...e.de>
Cc: linux-fsdevel@...r.kernel.org, jack@...e.com, hch@...radead.org,
linux-block@...r.kernel.org, linux-btrfs@...r.kernel.org,
linux-ext4@...r.kernel.org, linux-xfs@...r.kernel.org,
sagi@...mberg.me, avi@...lladb.com, axboe@...nel.dk,
linux-api@...r.kernel.org, willy@...radead.org,
tom.leiming@...il.com, Goldwyn Rodrigues <rgoldwyn@...e.com>
Subject: Re: [PATCH 8/8] nowait aio: btrfs
On Fri, Apr 14, 2017 at 07:02:57AM -0500, Goldwyn Rodrigues wrote:
> From: Goldwyn Rodrigues <rgoldwyn@...e.com>
>
> Return EAGAIN if any of the following checks fail
> + i_rwsem is not lockable
> + NODATACOW or PREALLOC is not set
> + Cannot nocow at the desired location
> + Writing beyond end of file which is not allocated
>
> Signed-off-by: Goldwyn Rodrigues <rgoldwyn@...e.com>
Acked-by: David Sterba <dsterba@...e.com>
> + if ((iocb->ki_flags & IOCB_NOWAIT) &&
> + (iocb->ki_flags & IOCB_DIRECT)) {
> + /* Don't sleep on inode rwsem */
> + if (!inode_trylock(inode))
> + return -EAGAIN;
> + /*
> + * We will allocate space in case nodatacow is not set,
> + * so bail
> + */
> + if (!(BTRFS_I(inode)->flags & (BTRFS_INODE_NODATACOW |
> + BTRFS_INODE_PREALLOC)) ||
> + check_can_nocow(BTRFS_I(inode), pos, &count) <= 0) {
> + inode_unlock(inode);
> + return -EAGAIN;
> + }
> + } else
} else {
> + inode_lock(inode);
}
Powered by blists - more mailing lists