All of lore.kernel.org
 help / color / mirror / Atom feed
* [Cluster-devel] [PATCH v6 1/4] iomap: Clean up __generic_write_end calling
@ 2019-04-29 16:32 ` Andreas Gruenbacher
  0 siblings, 0 replies; 20+ messages in thread
From: Andreas Gruenbacher @ 2019-04-29 16:32 UTC (permalink / raw)
  To: cluster-devel.redhat.com

From: Christoph Hellwig <hch@lst.de>

Move the call to __generic_write_end into iomap_write_end instead of
duplicating it in each of the three branches.  This requires open coding
the generic_write_end for the buffer_head case.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
 fs/iomap.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/fs/iomap.c b/fs/iomap.c
index 97cb9d486a7d..2344c662e6fc 100644
--- a/fs/iomap.c
+++ b/fs/iomap.c
@@ -738,13 +738,11 @@ __iomap_write_end(struct inode *inode, loff_t pos, unsigned len,
 	 * uptodate page as a zero-length write, and force the caller to redo
 	 * the whole thing.
 	 */
-	if (unlikely(copied < len && !PageUptodate(page))) {
-		copied = 0;
-	} else {
-		iomap_set_range_uptodate(page, offset_in_page(pos), len);
-		iomap_set_page_dirty(page);
-	}
-	return __generic_write_end(inode, pos, copied, page);
+	if (unlikely(copied < len && !PageUptodate(page)))
+		return 0;
+	iomap_set_range_uptodate(page, offset_in_page(pos), len);
+	iomap_set_page_dirty(page);
+	return copied;
 }
 
 static int
@@ -761,7 +759,6 @@ iomap_write_end_inline(struct inode *inode, struct page *page,
 	kunmap_atomic(addr);
 
 	mark_inode_dirty(inode);
-	__generic_write_end(inode, pos, copied, page);
 	return copied;
 }
 
@@ -774,12 +771,13 @@ iomap_write_end(struct inode *inode, loff_t pos, unsigned len,
 	if (iomap->type == IOMAP_INLINE) {
 		ret = iomap_write_end_inline(inode, page, iomap, pos, copied);
 	} else if (iomap->flags & IOMAP_F_BUFFER_HEAD) {
-		ret = generic_write_end(NULL, inode->i_mapping, pos, len,
-				copied, page, NULL);
+		ret = block_write_end(NULL, inode->i_mapping, pos, len, copied,
+				page, NULL);
 	} else {
 		ret = __iomap_write_end(inode, pos, len, copied, page, iomap);
 	}
 
+	ret = __generic_write_end(inode, pos, ret, page);
 	if (iomap->page_done)
 		iomap->page_done(inode, pos, copied, page, iomap);
 
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2019-04-29 21:44 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-29 16:32 [Cluster-devel] [PATCH v6 1/4] iomap: Clean up __generic_write_end calling Andreas Gruenbacher
2019-04-29 16:32 ` Andreas Gruenbacher
2019-04-29 16:32 ` [Cluster-devel] [PATCH v6 2/4] iomap: Fix use-after-free error in page_done callback Andreas Gruenbacher
2019-04-29 16:32   ` Andreas Gruenbacher
2019-04-29 19:43   ` [Cluster-devel] " Christoph Hellwig
2019-04-29 19:43     ` Christoph Hellwig
2019-04-29 16:32 ` [Cluster-devel] [PATCH v6 3/4] iomap: Add a page_prepare callback Andreas Gruenbacher
2019-04-29 16:32   ` Andreas Gruenbacher
2019-04-29 19:44   ` [Cluster-devel] " Christoph Hellwig
2019-04-29 19:44     ` Christoph Hellwig
2019-04-29 21:41   ` [Cluster-devel] " Jan Kara
2019-04-29 21:41     ` Jan Kara
2019-04-29 16:32 ` [Cluster-devel] [PATCH v6 4/4] gfs2: Fix iomap write page reclaim deadlock Andreas Gruenbacher
2019-04-29 16:32   ` Andreas Gruenbacher
2019-04-29 17:46 ` [Cluster-devel] [PATCH v6 1/4] iomap: Clean up __generic_write_end calling Andreas Gruenbacher
2019-04-29 17:46   ` Andreas Gruenbacher
2019-04-29 19:42   ` [Cluster-devel] " Christoph Hellwig
2019-04-29 19:42     ` Christoph Hellwig
2019-04-29 21:44 ` [Cluster-devel] " Jan Kara
2019-04-29 21:44   ` Jan Kara

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.