diff mbox

[vfs,v2,1/4] VFS: move iomap infrastructure from exportfs.h, add iomap to aops

Message ID 1457033515-7521-2-git-send-email-rpeterso@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Bob Peterson March 3, 2016, 7:31 p.m. UTC
This patch moves the iomap infrastructure from its current location in
exportfs.h to a new iomap.h. This may be used not only by nfs, but also by
other file systems. This also adds an iomap function call to the
address_space_operations. This will facilitate future improvements such
as a more efficient fiemap for holey files. Hopefully it will one day be
used for multipage writes as well.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
---
 include/linux/exportfs.h | 16 +---------------
 include/linux/fs.h       |  2 ++
 include/linux/iomap.h    | 29 +++++++++++++++++++++++++++++
 3 files changed, 32 insertions(+), 15 deletions(-)
 create mode 100644 include/linux/iomap.h

Comments

Christoph Hellwig March 4, 2016, 5:04 p.m. UTC | #1
On Thu, Mar 03, 2016 at 02:31:52PM -0500, Bob Peterson wrote:
> This patch moves the iomap infrastructure from its current location in
> exportfs.h to a new iomap.h. This may be used not only by nfs, but also by

NFS never uses iomaps so far :)

> other file systems. This also adds an iomap function call to the
> address_space_operations.

It doesn't.  And adding that would be a horrible idea.

But it adds new fields and flag, some of which look flakey.
Please do a plain move as a first step.

It would also be great it you didn't include iomap.h in fs.h - fs.h
already includes way too much crap.
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h
index fa05e04..bb564c1 100644
--- a/include/linux/exportfs.h
+++ b/include/linux/exportfs.h
@@ -2,6 +2,7 @@ 
 #define LINUX_EXPORTFS_H 1
 
 #include <linux/types.h>
+#include <linux/iomap.h>
 
 struct dentry;
 struct iattr;
@@ -181,21 +182,6 @@  struct fid {
  *    get_name is not (which is possibly inconsistent)
  */
 
-/* types of block ranges for multipage write mappings. */
-#define IOMAP_HOLE	0x01	/* no blocks allocated, need allocation */
-#define IOMAP_DELALLOC	0x02	/* delayed allocation blocks */
-#define IOMAP_MAPPED	0x03	/* blocks allocated @blkno */
-#define IOMAP_UNWRITTEN	0x04	/* blocks allocated @blkno in unwritten state */
-
-#define IOMAP_NULL_BLOCK -1LL	/* blkno is not valid */
-
-struct iomap {
-	sector_t	blkno;	/* first sector of mapping */
-	loff_t		offset;	/* file offset of mapping, bytes */
-	u64		length;	/* length of mapping, bytes */
-	int		type;	/* type of mapping */
-};
-
 struct export_operations {
 	int (*encode_fh)(struct inode *inode, __u32 *fh, int *max_len,
 			struct inode *parent);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index daf399d..6ae2b37 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -21,6 +21,7 @@ 
 #include <linux/capability.h>
 #include <linux/semaphore.h>
 #include <linux/fiemap.h>
+#include <linux/iomap.h>
 #include <linux/rculist_bl.h>
 #include <linux/atomic.h>
 #include <linux/shrinker.h>
@@ -316,6 +317,7 @@  enum positive_aop_returns {
 struct page;
 struct address_space;
 struct writeback_control;
+struct iomap;
 
 #define IOCB_EVENTFD		(1 << 0)
 #define IOCB_APPEND		(1 << 1)
diff --git a/include/linux/iomap.h b/include/linux/iomap.h
new file mode 100644
index 0000000..0026258
--- /dev/null
+++ b/include/linux/iomap.h
@@ -0,0 +1,29 @@ 
+#ifndef _IOMAP_H
+#define _IOMAP_H
+
+/* iomap flags */
+#define IOMAP_MODE_READ	0x01	/* iomap operation requires RO lock */
+#define IOMAP_MODE_RDWR	0x02	/* iomap operation requires R/W lock */
+
+/* types of block ranges for multipage write mappings. */
+#define IOMAP_HOLE	0x01	/* no blocks allocated, need allocation */
+#define IOMAP_DELALLOC	0x02	/* delayed allocation blocks */
+#define IOMAP_MAPPED	0x03	/* blocks allocated @blkno */
+#define IOMAP_UNWRITTEN	0x04	/* blocks allocated @blkno in unwritten state */
+
+#define IOMAP_NULL_BLOCK -1LL	/* blkno is not valid */
+
+struct iomap {
+	sector_t	blkno;	/* first sector of mapping */
+	loff_t		offset;	/* file offset of mapping, bytes */
+	ssize_t		length;	/* length of mapping, bytes */
+	int		type;	/* type of mapping */
+	void		*priv;	/* fs private data associated with map */
+};
+
+static inline bool iomap_needs_allocation(struct iomap *iomap)
+{
+	return iomap->type == IOMAP_HOLE;
+}
+
+#endif /* _IOMAP_H */