From patchwork Thu Jun 14 12:04:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 929392 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="ijN0uoD3"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 4162Pb3r6gz9s19 for ; Thu, 14 Jun 2018 22:05:23 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936085AbeFNMFV (ORCPT ); Thu, 14 Jun 2018 08:05:21 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:34020 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936080AbeFNMFS (ORCPT ); Thu, 14 Jun 2018 08:05:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=3LBRpzTFSCJfsYOzT4QD0ruvSNnISTkc2R6eRIX9ZsA=; b=ijN0uoD33T/XFroFNAzOKDn2j /m+GXf400wgFU9zIricFGozW8OTrycx7Pzxr0I6U7LsY9mwSu7t97SzfDM7Vb2FS0jNSBa5bQ0GgK Zq7IUq4A8zR3H7BlfOjidORRLuaBoXxlcQ7KByN4ZG4rrLs+p0Z0VlaqgXMGjUSxT2rIZzeX48SEP PQ3zNuE0Z9apjPf4Pj3ZqDBzouSergTkXLFfC3sMx4xNzBTaI/jBaK5raXiQwwWeKnUmwFleFagJX YxRQtd+h2dOJdyiDR0qZjGxx20vwfC1z7KVTLC/52163DaffQJr0wjg4mT7Zm117NfD3KmxHrTLRR Ih5WTeVoQ==; Received: from 80-109-164-210.cable.dynamic.surfer.at ([80.109.164.210] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fTR09-00069O-6x; Thu, 14 Jun 2018 12:05:17 +0000 From: Christoph Hellwig To: Andreas Gruenbacher , linux-xfs@vger.kernel.org Cc: Dan Williams , linux-fsdevel@vger.kernel.org, cluster-devel@redhat.com, linux-ext4@vger.kernel.org Subject: [PATCH 6/6] iomap: add a page_done callback Date: Thu, 14 Jun 2018 14:04:57 +0200 Message-Id: <20180614120457.28285-7-hch@lst.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180614120457.28285-1-hch@lst.de> References: <20180614120457.28285-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org This will be used by gfs2 to attach data to transactions for the journaled data mode. But the concept is generic enough that we might be able to use it for other purposes like encryption/integrity post-processing in the future. Based on a patch from Andreas Gruenbacher. Signed-off-by: Christoph Hellwig --- fs/iomap.c | 3 +++ include/linux/iomap.h | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/fs/iomap.c b/fs/iomap.c index 6d5a2ebe5dd8..9e265118e8b0 100644 --- a/fs/iomap.c +++ b/fs/iomap.c @@ -201,6 +201,9 @@ iomap_write_end(struct inode *inode, loff_t pos, unsigned len, copied, page, NULL); } + if (iomap->page_done) + iomap->page_done(inode, pos, copied, page, iomap); + if (ret < len) iomap_write_failed(inode, pos, len); return ret; diff --git a/include/linux/iomap.h b/include/linux/iomap.h index 69ef622f650e..43cc9208599f 100644 --- a/include/linux/iomap.h +++ b/include/linux/iomap.h @@ -9,6 +9,7 @@ struct fiemap_extent_info; struct inode; struct iov_iter; struct kiocb; +struct page; struct vm_area_struct; struct vm_fault; @@ -58,6 +59,14 @@ struct iomap { struct dax_device *dax_dev; void *inline_data; }; + + /* + * Called when finished processing a page in the mapping returned in + * this iomap. At least for now this is only supported in the buffered + * write path. + */ + void (*page_done)(struct inode *inode, loff_t pos, unsigned copied, + struct page *page, struct iomap *iomap); }; /*