Skip to contentSkip to conversation

Removing aio_write from NTFS

PATCH New [email protected] 1 participant 3 messages Mar 11, 2015

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover Removing aio_write from NTFS

From: Anton Altaparmakov <[email protected]>

Hi Al,

As you requested at LSF, these two patches change NTFS from aio_write to write_iter.

I know you were sceptical about the addition of a multi page fault in function but please take a look at my patches and see if it is acceptable. If not, let me know and I will do it inside NTFS itself without introducing a generic function...

If you are happy with the patches, please feel free to send them onto Linus or let me know to send them myself.

Note you can also pull the patches from:

git://git.kernel.org/pub/scm/linux/kernel/git/aia21/ntfs.git

Best regards,

Anton

Anton Altaparmakov (2):
VFS: Add iov_iter_fault_in_multipages_readable() which is simillar to
iov_iter_fault_in_readable() but differs in that it is not
limited to faulting in the first iovec and instead faults in
"bytes" bytes iterating over the iovecs as necessary.
NTFS: Version 2.1.32 - Update file write from aio_write to write_iter.

 fs/ntfs/Makefile    |   2 +-
 fs/ntfs/file.c      | 783 ++++++++++++++++++++--------------------------------
 include/linux/uio.h |   1 +
 mm/iov_iter.c       |  26 ++
 4 files changed, 335 insertions(+), 477 deletions(-)
Signature · 3 lines
Anton Altaparmakov <anton at tuxera.com> (replace at with @)
Lead in File System Development, Tuxera Inc., http://www.tuxera.com/
Linux NTFS maintainer
#1 lore raw

PATCH 1/2 VFS: Add iov_iter_fault_in_multipages_readable() which is simillar to iov_iter_fault_in_readable() but differs in that it is not limited to faulting in the first iovec and instead faults in "bytes" bytes iterating over the iovecs as necessary.

From: Anton Altaparmakov <[email protected]>

Also, instead of only faulting in the first and last page of the range, all pages are faulted in.

This function is needed by NTFS when it does multi page file writes.

---
 include/linux/uio.h |  1 +
 mm/iov_iter.c       | 26 ++++++++++++++++++++++++++
 2 files changed, 27 insertions(+)
include/linux/uio.h +1 -0
index 07a0226..2986d5d 100644
@@ -76,6 +76,7 @@ size_t iov_iter_copy_from_user_atomic(struct page *page,
 		struct iov_iter *i, unsigned long offset, size_t bytes);
 void iov_iter_advance(struct iov_iter *i, size_t bytes);
 int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes);
+int iov_iter_fault_in_multipages_readable(struct iov_iter *i, size_t bytes);
 size_t iov_iter_single_seg_count(const struct iov_iter *i);
 size_t copy_page_to_iter(struct page *page, size_t offset, size_t bytes,
 			 struct iov_iter *i);
mm/iov_iter.c +26 -0
index 8277320..040ad9e 100644
@@ -317,6 +317,32 @@ int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes)
 }
 EXPORT_SYMBOL(iov_iter_fault_in_readable);
 
+/*
+ * Fault in one or more iovecs of the given iov_iter, to a maximum length of
+ * bytes.  For each iovec, fault in each page that constitutes the iovec.
+ *
+ * Return 0 on success, or non-zero if the memory could not be accessed (i.e.
+ * because it is an invalid address).
+ */
+int iov_iter_fault_in_multipages_readable(struct iov_iter *i, size_t bytes)
+{
+	size_t skip = i->iov_offset;
+	const struct iovec *iov;
+	int err;
+	struct iovec v;
+
+	if (!(i->type & (ITER_BVEC|ITER_KVEC))) {
+		iterate_iovec(i, bytes, v, iov, skip, ({
+			err = fault_in_multipages_readable(v.iov_base,
+					v.iov_len);
+			if (unlikely(err))
+			return err;
+		0;}))
+	}
+	return 0;
+}
+EXPORT_SYMBOL(iov_iter_fault_in_multipages_readable);
+
 void iov_iter_init(struct iov_iter *i, int direction,
 			const struct iovec *iov, unsigned long nr_segs,
 			size_t count)
Signature · 1 line
1.9.3 (Apple Git-50)
#2 lore raw

PATCH 2/2 NTFS: Version 2.1.32 - Update file write from aio_write to write_iter.

In reply to [email protected]

From: Anton Altaparmakov <[email protected]>

---
 fs/ntfs/Makefile |   2 +-
 fs/ntfs/file.c   | 783 ++++++++++++++++++++++---------------------------------
 2 files changed, 308 insertions(+), 477 deletions(-)
fs/ntfs/Makefile +1 -1
index 36ae529..2ff263e 100644
@@ -8,7 +8,7 @@ ntfs-y := aops.o attrib.o collate.o compress.o debug.o dir.o file.o \
 
 ntfs-$(CONFIG_NTFS_RW) += bitmap.o lcnalloc.o logfile.o quota.o usnjrnl.o
 
-ccflags-y := -DNTFS_VERSION=\"2.1.31\"
+ccflags-y := -DNTFS_VERSION=\"2.1.32\"
 ccflags-$(CONFIG_NTFS_DEBUG)	+= -DDEBUG
 ccflags-$(CONFIG_NTFS_RW)	+= -DNTFS_RW
 
fs/ntfs/file.c +307 -476

927 lines not on this page · raw message

Signature · 1 line
1.9.3 (Apple Git-50)