From: Christoph Hellwig <hch@lst.de> To: linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-block@vger.kernel.org Subject: [PATCH 02/12] iomap: pass IOMAP_* flags to actors Date: Tue, 28 Feb 2017 06:57:27 -0800 [thread overview] Message-ID: <20170228145737.19016-3-hch@lst.de> (raw) In-Reply-To: <20170228145737.19016-1-hch@lst.de> This will be needed to implement O_ATOMIC. Signed-off-by: Christoph Hellwig <hch@lst.de> --- fs/dax.c | 2 +- fs/internal.h | 2 +- fs/iomap.c | 39 +++++++++++++++++++++------------------ 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index 78b9651576c6..5d71fc5f0a08 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -997,7 +997,7 @@ static sector_t dax_iomap_sector(struct iomap *iomap, loff_t pos) static loff_t dax_iomap_actor(struct inode *inode, loff_t pos, loff_t length, void *data, - struct iomap *iomap) + struct iomap *iomap, unsigned flags) { struct iov_iter *iter = data; loff_t end = pos + length, done = 0; diff --git a/fs/internal.h b/fs/internal.h index 11c6d89dce9c..1934fdb2bb27 100644 --- a/fs/internal.h +++ b/fs/internal.h @@ -179,7 +179,7 @@ extern long vfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg); * iomap support: */ typedef loff_t (*iomap_actor_t)(struct inode *inode, loff_t pos, loff_t len, - void *data, struct iomap *iomap); + void *data, struct iomap *iomap, unsigned flags); loff_t iomap_apply(struct inode *inode, loff_t pos, loff_t length, unsigned flags, const struct iomap_ops *ops, void *data, diff --git a/fs/iomap.c b/fs/iomap.c index 7f08ca03d95d..16a9d2b89cb6 100644 --- a/fs/iomap.c +++ b/fs/iomap.c @@ -76,7 +76,7 @@ iomap_apply(struct inode *inode, loff_t pos, loff_t length, unsigned flags, * we can do the copy-in page by page without having to worry about * failures exposing transient data. */ - written = actor(inode, pos, length, data, &iomap); + written = actor(inode, pos, length, data, &iomap, flags); /* * Now the data has been copied, commit the range we've copied. This @@ -105,8 +105,9 @@ iomap_write_failed(struct inode *inode, loff_t pos, unsigned len) } static int -iomap_write_begin(struct inode *inode, loff_t pos, unsigned len, unsigned flags, - struct page **pagep, struct iomap *iomap) +iomap_write_begin(struct inode *inode, loff_t pos, unsigned len, + unsigned aop_flags, struct page **pagep, struct iomap *iomap, + unsigned flags) { pgoff_t index = pos >> PAGE_SHIFT; struct page *page; @@ -114,7 +115,7 @@ iomap_write_begin(struct inode *inode, loff_t pos, unsigned len, unsigned flags, BUG_ON(pos + len > iomap->offset + iomap->length); - page = grab_cache_page_write_begin(inode->i_mapping, index, flags); + page = grab_cache_page_write_begin(inode->i_mapping, index, aop_flags); if (!page) return -ENOMEM; @@ -146,18 +147,18 @@ iomap_write_end(struct inode *inode, loff_t pos, unsigned len, static loff_t iomap_write_actor(struct inode *inode, loff_t pos, loff_t length, void *data, - struct iomap *iomap) + struct iomap *iomap, unsigned flags) { struct iov_iter *i = data; long status = 0; ssize_t written = 0; - unsigned int flags = AOP_FLAG_NOFS; + unsigned int aop_flags = AOP_FLAG_NOFS; /* * Copies from kernel address space cannot fail (NFSD is a big user). */ if (!iter_is_iovec(i)) - flags |= AOP_FLAG_UNINTERRUPTIBLE; + aop_flags |= AOP_FLAG_UNINTERRUPTIBLE; do { struct page *page; @@ -187,8 +188,8 @@ iomap_write_actor(struct inode *inode, loff_t pos, loff_t length, void *data, break; } - status = iomap_write_begin(inode, pos, bytes, flags, &page, - iomap); + status = iomap_write_begin(inode, pos, bytes, aop_flags, &page, + iomap, flags); if (unlikely(status)) break; @@ -268,7 +269,7 @@ __iomap_read_page(struct inode *inode, loff_t offset) static loff_t iomap_dirty_actor(struct inode *inode, loff_t pos, loff_t length, void *data, - struct iomap *iomap) + struct iomap *iomap, unsigned flags) { long status = 0; ssize_t written = 0; @@ -287,7 +288,7 @@ iomap_dirty_actor(struct inode *inode, loff_t pos, loff_t length, void *data, status = iomap_write_begin(inode, pos, bytes, AOP_FLAG_NOFS | AOP_FLAG_UNINTERRUPTIBLE, - &page, iomap); + &page, iomap, flags); put_page(rpage); if (unlikely(status)) return status; @@ -333,13 +334,14 @@ iomap_file_dirty(struct inode *inode, loff_t pos, loff_t len, EXPORT_SYMBOL_GPL(iomap_file_dirty); static int iomap_zero(struct inode *inode, loff_t pos, unsigned offset, - unsigned bytes, struct iomap *iomap) + unsigned bytes, struct iomap *iomap, unsigned flags) { struct page *page; int status; status = iomap_write_begin(inode, pos, bytes, - AOP_FLAG_UNINTERRUPTIBLE | AOP_FLAG_NOFS, &page, iomap); + AOP_FLAG_UNINTERRUPTIBLE | AOP_FLAG_NOFS, &page, iomap, + flags); if (status) return status; @@ -360,7 +362,7 @@ static int iomap_dax_zero(loff_t pos, unsigned offset, unsigned bytes, static loff_t iomap_zero_range_actor(struct inode *inode, loff_t pos, loff_t count, - void *data, struct iomap *iomap) + void *data, struct iomap *iomap, unsigned flags) { bool *did_zero = data; loff_t written = 0; @@ -379,7 +381,8 @@ iomap_zero_range_actor(struct inode *inode, loff_t pos, loff_t count, if (IS_DAX(inode)) status = iomap_dax_zero(pos, offset, bytes, iomap); else - status = iomap_zero(inode, pos, offset, bytes, iomap); + status = iomap_zero(inode, pos, offset, bytes, iomap, + flags); if (status < 0) return status; @@ -429,7 +432,7 @@ EXPORT_SYMBOL_GPL(iomap_truncate_page); static loff_t iomap_page_mkwrite_actor(struct inode *inode, loff_t pos, loff_t length, - void *data, struct iomap *iomap) + void *data, struct iomap *iomap, unsigned flags) { struct page *page = data; int ret; @@ -521,7 +524,7 @@ static int iomap_to_fiemap(struct fiemap_extent_info *fi, static loff_t iomap_fiemap_actor(struct inode *inode, loff_t pos, loff_t length, void *data, - struct iomap *iomap) + struct iomap *iomap, unsigned flags) { struct fiemap_ctx *ctx = data; loff_t ret = length; @@ -730,7 +733,7 @@ iomap_dio_zero(struct iomap_dio *dio, struct iomap *iomap, loff_t pos, static loff_t iomap_dio_actor(struct inode *inode, loff_t pos, loff_t length, - void *data, struct iomap *iomap) + void *data, struct iomap *iomap, unsigned flags) { struct iomap_dio *dio = data; unsigned blkbits = blksize_bits(bdev_logical_block_size(iomap->bdev)); -- 2.11.0
next prev parent reply other threads:[~2017-02-28 14:58 UTC|newest] Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-02-28 14:57 [RFC] failure atomic writes for file systems and block devices Christoph Hellwig 2017-02-28 14:57 ` [PATCH 01/12] uapi/fs: add O_ATOMIC to the open flags Christoph Hellwig 2017-02-28 14:57 ` Christoph Hellwig [this message] 2017-02-28 14:57 ` [PATCH 03/12] iomap: add a IOMAP_ATOMIC flag Christoph Hellwig 2017-02-28 14:57 ` [PATCH 04/12] fs: add a BH_Atomic flag Christoph Hellwig 2017-02-28 14:57 ` [PATCH 05/12] fs: add a F_IOINFO fcntl Christoph Hellwig 2017-02-28 16:51 ` Darrick J. Wong 2017-03-01 15:11 ` Christoph Hellwig 2017-02-28 14:57 ` [PATCH 06/12] xfs: cleanup is_reflink checks Christoph Hellwig 2017-02-28 14:57 ` [PATCH 07/12] xfs: implement failure-atomic writes Christoph Hellwig 2017-02-28 23:09 ` Darrick J. Wong 2017-03-01 15:17 ` Christoph Hellwig 2017-02-28 14:57 ` [PATCH 08/12] xfs: implement the F_IOINFO fcntl Christoph Hellwig 2017-02-28 14:57 ` [PATCH 09/12] block: advertize max atomic write limit Christoph Hellwig 2017-02-28 14:57 ` [PATCH 10/12] block_dev: set REQ_NOMERGE for O_ATOMIC writes Christoph Hellwig 2017-02-28 14:57 ` [PATCH 11/12] block_dev: implement the F_IOINFO fcntl Christoph Hellwig 2017-02-28 14:57 ` [PATCH 12/12] nvme: export the atomic write limit Christoph Hellwig 2017-02-28 20:48 ` [RFC] failure atomic writes for file systems and block devices Chris Mason 2017-02-28 20:48 ` Chris Mason 2017-03-01 15:07 ` Christoph Hellwig 2017-02-28 23:22 ` Darrick J. Wong 2017-03-01 15:09 ` Christoph Hellwig 2017-03-01 11:21 ` Amir Goldstein 2017-03-01 15:07 ` Christoph Hellwig 2017-03-01 15:07 ` Christoph Hellwig
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20170228145737.19016-3-hch@lst.de \ --to=hch@lst.de \ --cc=linux-block@vger.kernel.org \ --cc=linux-fsdevel@vger.kernel.org \ --cc=linux-xfs@vger.kernel.org \ --subject='Re: [PATCH 02/12] iomap: pass IOMAP_* flags to actors' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.