[PATCH 5/8] iomap: Pass iomap_write_ctx to iomap_write_actor()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We need to pass a little more information to iomap_write_actor(),
so define our own little struct for it.

Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>
---
 fs/iomap/buffered-io.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
index ad9d8fe97f2e..a74da66e64a7 100644
--- a/fs/iomap/buffered-io.c
+++ b/fs/iomap/buffered-io.c
@@ -514,6 +514,13 @@ enum {
 	IOMAP_WRITE_F_UNSHARE		= (1 << 0),
 };
 
+struct iomap_write_ctx {
+	struct iov_iter *iter;
+	struct iomap_ioend *ioend;
+	struct list_head iolist;
+	bool write_through;
+};
+
 static void
 iomap_write_failed(struct inode *inode, loff_t pos, unsigned len)
 {
@@ -734,7 +741,8 @@ static loff_t
 iomap_write_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
 		struct iomap *iomap, struct iomap *srcmap)
 {
-	struct iov_iter *i = data;
+	struct iomap_write_ctx *iwc = data;
+	struct iov_iter *i = iwc->iter;
 	long status = 0;
 	ssize_t written = 0;
 
@@ -804,12 +812,17 @@ ssize_t
 iomap_file_buffered_write(struct kiocb *iocb, struct iov_iter *iter,
 		const struct iomap_ops *ops)
 {
+	struct iomap_write_ctx iwc = {
+		.iter = iter,
+		.iolist = LIST_HEAD_INIT(iwc.iolist),
+		.write_through = iocb->ki_flags & IOCB_SYNC,
+	};
 	struct inode *inode = iocb->ki_filp->f_mapping->host;
 	loff_t pos = iocb->ki_pos, ret = 0, written = 0;
 
 	while (iov_iter_count(iter)) {
 		ret = iomap_apply(inode, pos, iov_iter_count(iter),
-				IOMAP_WRITE, ops, iter, iomap_write_actor);
+				IOMAP_WRITE, ops, &iwc, iomap_write_actor);
 		if (ret <= 0)
 			break;
 		pos += ret;
-- 
2.30.2




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux