xfs
[Top] [All Lists]

[PATCH 5/7] iomap: mark ->iomap_end as optional

To: xfs@xxxxxxxxxxx
Subject: [PATCH 5/7] iomap: mark ->iomap_end as optional
From: Christoph Hellwig <hch@xxxxxx>
Date: Sat, 13 Aug 2016 16:42:59 -0700
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1471131781-14107-1-git-send-email-hch@xxxxxx>
References: <1471131781-14107-1-git-send-email-hch@xxxxxx>
No need to implement it for read-only mappings.

Signed-off-by: Christoph Hellwig <hch@xxxxxx>
---
 fs/iomap.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/fs/iomap.c b/fs/iomap.c
index d9d1f50..0342254 100644
--- a/fs/iomap.c
+++ b/fs/iomap.c
@@ -84,8 +84,11 @@ iomap_apply(struct inode *inode, loff_t pos, loff_t length, 
unsigned flags,
         * Now the data has been copied, commit the range we've copied.  This
         * should not fail unless the filesystem has had a fatal error.
         */
-       ret = ops->iomap_end(inode, pos, length, written > 0 ? written : 0,
-                       flags, &iomap);
+       if (ops->iomap_end) {
+               ret = ops->iomap_end(inode, pos, length,
+                                    written > 0 ? written : 0,
+                                    flags, &iomap);
+       }
 
        return written ? written : ret;
 }
-- 
2.1.4

<Prev in Thread] Current Thread [Next in Thread>