Skip to contentSkip to conversation

pass iocb to dio_iodone_t

PATCH In review Christoph Hellwig 3 participants 5 messages Jun 10, 2005

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

PATCH 1/1 pass iocb to dio_iodone_t

XFS will have to look at iocb->private to fix aio+dio. No other filesystem is using the blockdev_direct_IO* end_io callback.

include/linux/fs.h +2 -2
Index: xfs-2.6.x/include/linux/fs.h
===================================================================
@@ -219,6 +219,7 @@
 
 struct iovec;
 struct nameidata;
+struct kiocb;
 struct pipe_inode_info;
 struct poll_table_struct;
 struct kstatfs;
@@ -239,7 +240,7 @@
 typedef int (get_blocks_t)(struct inode *inode, sector_t iblock,
 			unsigned long max_blocks,
 			struct buffer_head *bh_result, int create);
-typedef void (dio_iodone_t)(struct inode *inode, loff_t offset,
+typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
 			ssize_t bytes, void *private);
 
 /*
@@ -301,7 +302,6 @@
 struct page;
 struct address_space;
 struct writeback_control;
-struct kiocb;
 
 struct address_space_operations {
 	int (*writepage)(struct page *page, struct writeback_control *wbc);
fs/direct-io.c +1 -1
Index: xfs-2.6.x/fs/direct-io.c
===================================================================
@@ -214,7 +214,7 @@
 static void dio_complete(struct dio *dio, loff_t offset, ssize_t bytes)
 {
 	if (dio->end_io && dio->result)
-		dio->end_io(dio->inode, offset, bytes, dio->map_bh.b_private);
+		dio->end_io(dio->iocb, offset, bytes, dio->map_bh.b_private);
 	if (dio->lock_type == DIO_LOCKING)
 		up_read(&dio->inode->i_alloc_sem);
 }
fs/xfs/linux-2.6/xfs_aops.c +2 -1
Index: xfs-2.6.x/fs/xfs/linux-2.6/xfs_aops.c
===================================================================
@@ -167,11 +167,12 @@
  */
 STATIC void
 linvfs_unwritten_convert_direct(
-	struct inode	*inode,
+	struct kiocb	*iocb,
 	loff_t		offset,
 	ssize_t		size,
 	void		*private)
 {
+	struct inode	*inode = iocb->ki_filp->f_dentry->d_inode;
 	ASSERT(!private || inode == (struct inode *)private);
 
 	/* private indicates an unwritten extent lay beneath this IO */
#1 lore raw

Just curious on why XFS needs end_io callback ?

And also, why is dio->inode != iocb->ki_filp->f_dentry->d_inode for XFS ?

Thanks,
Badari

Quoted 71 lines · Christoph Hellwig

XFS will have to look at iocb->private to fix aio+dio. No other filesystem is using the blockdev_direct_IO* end_io callback.

Index: xfs-2.6.x/include/linux/fs.h
===================================================================

include/linux/fs.h +2 -2
@@ -219,6 +219,7 @@
 
 struct iovec;
 struct nameidata;
+struct kiocb;
 struct pipe_inode_info;
 struct poll_table_struct;
 struct kstatfs;
@@ -239,7 +240,7 @@
 typedef int (get_blocks_t)(struct inode *inode, sector_t iblock,
 			unsigned long max_blocks,
 			struct buffer_head *bh_result, int create);
-typedef void (dio_iodone_t)(struct inode *inode, loff_t offset,
+typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
 			ssize_t bytes, void *private);
 
 /*
@@ -301,7 +302,6 @@
 struct page;
 struct address_space;
 struct writeback_control;
-struct kiocb;
 
 struct address_space_operations {
 	int (*writepage)(struct page *page, struct writeback_control *wbc);

Index: xfs-2.6.x/fs/direct-io.c
===================================================================

fs/direct-io.c +1 -1
@@ -214,7 +214,7 @@
 static void dio_complete(struct dio *dio, loff_t offset, ssize_t bytes)
 {
 	if (dio->end_io && dio->result)
-		dio->end_io(dio->inode, offset, bytes, dio->map_bh.b_private);
+		dio->end_io(dio->iocb, offset, bytes, dio->map_bh.b_private);
 	if (dio->lock_type == DIO_LOCKING)
 		up_read(&dio->inode->i_alloc_sem);
 }

Index: xfs-2.6.x/fs/xfs/linux-2.6/xfs_aops.c
===================================================================

fs/xfs/linux-2.6/xfs_aops.c +2 -2
@@ -167,11 +167,12 @@
  */
 STATIC void
 linvfs_unwritten_convert_direct(
-	struct inode	*inode,
+	struct kiocb	*iocb,
 	loff_t		offset,
 	ssize_t		size,
 	void		*private)
 {
+	struct inode	*inode = iocb->ki_filp->f_dentry->d_inode;
 	ASSERT(!private || inode == (struct inode *)private);
 
 	/* private indicates an unwritten extent lay beneath this IO */
-

To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 1 line · Badari Pulavarty

Just curious on why XFS needs end_io callback ?

To convert unwritten extents to written extents.

Quoted 2 lines

And also, why is dio->inode != iocb->ki_filp->f_dentry->d_inode for XFS ?

It's not.

#3 lore raw
Quoted 9 lines · Christoph Hellwig
Quoted 1 line · Badari Pulavarty

Just curious on why XFS needs end_io callback ?

To convert unwritten extents to written extents.

Quoted 2 lines

And also, why is dio->inode != iocb->ki_filp->f_dentry->d_inode for XFS ?

It's not.

Hmm.. Then, I don't understand your patch. Is there a follow up patch to make use of iocb in linvfs_unwritten_convert_direct() ?

All you did was, to pass "iocb" instead of "inode". Then got inode from "iocb". (which you claimed they are same).

Am I miss understanding something ?

Thanks,
Badari

#4 lore raw
Quoted 6 lines · Badari Pulavarty
Quoted 5 lines · Christoph Hellwig
Quoted 1 line · Badari Pulavarty

Just curious on why XFS needs end_io callback ?

To convert unwritten extents to written extents.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

And also, why is dio->inode != iocb->ki_filp->f_dentry->d_inode for XFS ?

It's not.

Hmm.. Then, I don't understand your patch. Is there a follow up patch to make use of iocb in linvfs_unwritten_convert_direct() ?

Yes. It'll go in through the the normal xfs tree merges.

Quoted 4 lines

All you did was, to pass "iocb" instead of "inode". Then got inode from "iocb". (which you claimed they are same).

Am I miss understanding something ?

No, I should have mentioned that this is just a trivial infrastructure bit, the actual fix is a little more complicated.