Viewing: ext4-attach-jinode-in-writepages.patch

commit 66153d87190a3547099446d222f36114d3eeffad
Author:     Yang Sheng <ys@whamcloud.com>
AuthorDate: Tue Jan 24 03:31:27 2017 +0800
Subject: LU-9031 osd: handle jinode change for ldiskfs

We need to take care of jinode for ldiskfs. Since we
did not get the inode from syscall like sys_open(). So
we have to initialize it in OSD by ourselves.

Signed-off-by: Yang Sheng <yang.sheng@intel.com>
Change-Id: Iec6db290c3779a8f7c98e5d1356b71fd928d7c88
Reviewed-on: https://review.whamcloud.com/24941
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
---
 fs/ext4/ext4.h  | 1 +
 fs/ext4/inode.c | 9 ++++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

Index: linux-4.18.0-193.el8/fs/ext4/inode.c
===================================================================
--- linux-4.18.0-193.el8.orig/fs/ext4/inode.c
+++ linux-4.18.0-193.el8/fs/ext4/inode.c
@@ -731,6 +731,9 @@ out_sem:
 				(loff_t)map->m_lblk << inode->i_blkbits;
 			loff_t length = (loff_t)map->m_len << inode->i_blkbits;
 
+			ret = ext4_inode_attach_jinode(inode);
+			if (ret)
+				return ret;
 			if (flags & EXT4_GET_BLOCKS_IO_SUBMIT)
 				ret = ext4_jbd2_inode_add_wait(handle, inode,
 						start_byte, length);
@@ -2815,6 +2818,9 @@ static int ext4_writepages(struct addres
 		mpd.last_page = wbc->range_end >> PAGE_SHIFT;
 	}
 
+	ret = ext4_inode_attach_jinode(inode);
+	if (ret)
+		goto out_writepages;
 	mpd.inode = inode;
 	mpd.wbc = wbc;
 	ext4_io_submit_init(&mpd.io_submit, wbc);
@@ -4442,6 +4448,7 @@ int ext4_inode_attach_jinode(struct inod
 		jbd2_free_inode(jinode);
 	return 0;
 }
+EXPORT_SYMBOL(ext4_inode_attach_jinode);
 
 /*
  * ext4_truncate()
Index: linux-4.15.0/fs/ext4/ext4.h
===================================================================
--- linux-4.15.0.orig/fs/ext4/ext4.h
+++ linux-4.15.0/fs/ext4/ext4.h
@@ -2595,6 +2595,7 @@ extern int ext4_trim_fs(struct super_blo
 extern void ext4_process_freed_data(struct super_block *sb, tid_t commit_tid);
 
 /* inode.c */
+#define HAVE_LDISKFS_INFO_JINODE
 int ext4_inode_is_fast_symlink(struct inode *inode);
 struct buffer_head *ext4_getblk(handle_t *, struct inode *, ext4_lblk_t, int);
 struct buffer_head *ext4_bread(handle_t *, struct inode *, ext4_lblk_t, int);