mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jeremy Bingham <jbingham@gmail.com>
To: linux-fsdevel@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, brauner@kernel.org,
	jkoolstra@xs4all.nl, jack@suse.cz, djwong@kernel.org,
	viro@zeniv.linux.org.uk, hch@infradead.org,
	Jeremy Bingham <jbingham@gmail.com>
Subject: [PATCH v4 1/3] iomap: add iomap_symlink_write
Date: Wed, 26 Aug 2026 14:41:55 -0700	[thread overview]
Message-ID: <348ed49a8aa85c6c23c21034c8598401e9938e3d.1787770110.git.jbingham@gmail.com> (raw)
In-Reply-To: <cover.1787770110.git.jbingham@gmail.com>

Add a new iomap_symlink_write function as an iomap based equivalent to
page_symlink found in fs/namei.c. Part of being that equivalency is
behaving similarly to page_symlink. This function now expects the same
len as page_symlink, where len is the length of the null terminated
target string. The target is still written out without the trailing
null.

Suggested-by: Darrick J. Wong <djwong@kernel.org>
Suggested-by: Christoph Hellwig <hch@infradead.org>

Signed-off-by: Jeremy Bingham <jbingham@gmail.com>
---
 fs/iomap/buffered-io.c | 34 ++++++++++++++++++++++++++++++++++
 include/linux/iomap.h  |  3 +++
 2 files changed, 37 insertions(+)

diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
index 0a5ebfda90f1..5e8ac3fad671 100644
--- a/fs/iomap/buffered-io.c
+++ b/fs/iomap/buffered-io.c
@@ -2100,3 +2100,37 @@ iomap_writepages(struct iomap_writepage_ctx *wpc)
 	return error;
 }
 EXPORT_SYMBOL_GPL(iomap_writepages);
+
+int iomap_symlink_write(struct inode *inode, const char *target, int len,
+		const struct iomap_ops *ops,
+		const struct iomap_write_ops *write_ops, void *private)
+{
+	struct kvec vec = {
+		.iov_base	= (void *)target,
+		.iov_len	= len - 1,
+	};
+	struct iomap_iter iter = {
+		.inode		= inode,
+		.pos		= 0,
+		.len		= len - 1,
+		.flags		= IOMAP_WRITE,
+		.private	= private,
+	};
+	struct iov_iter iov;
+	int ret;
+
+	iov_iter_kvec(&iov, ITER_SOURCE, &vec, 1, len - 1);
+
+	while ((ret = iomap_iter(&iter, ops)) > 0)
+		iter.status = iomap_write_iter(&iter, &iov, write_ops);
+
+	if (ret < 0)
+		return ret;
+
+	if (unlikely(iter.pos == 0))
+		return -EIO;
+
+	mark_inode_dirty(inode);
+	return 0;
+}
+EXPORT_SYMBOL_GPL(iomap_symlink_write);
diff --git a/include/linux/iomap.h b/include/linux/iomap.h
index 8c754eb974fb..ab27a3a5b8d2 100644
--- a/include/linux/iomap.h
+++ b/include/linux/iomap.h
@@ -471,6 +471,9 @@ loff_t iomap_seek_data(struct inode *inode, loff_t offset,
 		const struct iomap_ops *ops);
 sector_t iomap_bmap(struct address_space *mapping, sector_t bno,
 		const struct iomap_ops *ops);
+int iomap_symlink_write(struct inode *inode, const char *target, int len,
+		const struct iomap_ops *ops,
+		const struct iomap_write_ops *write_ops, void *private);
 
 /*
  * Flags for iomap_ioend->io_flags.
-- 
2.47.3


  reply	other threads:[~2026-08-26 21:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-26 21:41 [PATCH v4 0/3] minix: convert to iomap Jeremy Bingham
2026-08-26 21:41 ` Jeremy Bingham [this message]
2026-09-18 13:48   ` [PATCH v4 1/3] iomap: add iomap_symlink_write Christoph Hellwig
2026-08-26 21:41 ` [PATCH v4 2/3] minix: add iomap functions and definitions Jeremy Bingham
2026-09-18 14:12   ` Christoph Hellwig
2026-09-19 17:51     ` Jeremy Bingham
2026-09-21  6:50       ` Christoph Hellwig
2026-09-21 18:16         ` Jeremy Bingham
2026-08-26 21:41 ` [PATCH v4 3/3] minix: finish wiring in iomap functions Jeremy Bingham
2026-09-18 15:10   ` Christoph Hellwig
2026-09-19 18:02     ` Jeremy Bingham

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=348ed49a8aa85c6c23c21034c8598401e9938e3d.1787770110.git.jbingham@gmail.com \
    --to=jbingham@gmail.com \
    --cc=brauner@kernel.org \
    --cc=djwong@kernel.org \
    --cc=hch@infradead.org \
    --cc=jack@suse.cz \
    --cc=jkoolstra@xs4all.nl \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®