--- /dev/null
+--- l1/fs/ext4/inode.c 2016-08-23 23:38:23.238091149 +0800
++++ l2/fs/ext4/inode.c 2017-01-24 04:04:45.100092653 +0800
+@@ -2683,6 +2683,9 @@ static int ext4_writepages(struct addres
+ mpd.last_page = wbc->range_end >> PAGE_CACHE_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);
+@@ -4015,6 +4015,7 @@ int ext4_inode_attach_jinode(struct inod
+ jbd2_free_inode(jinode);
+ return 0;
+ }
++EXPORT_SYMBOL(ext4_inode_attach_jinode);
+
+ /*
+ * ext4_truncate()
+--- l1/fs/ext4/ext4.h 2017-01-24 04:21:28.989470587 +0800
++++ l2/fs/ext4/ext4.h 2017-01-24 04:32:45.589800986 +0800
+@@ -2462,6 +2462,7 @@ extern int ext4_group_add_blocks(handle_
+ extern int ext4_trim_fs(struct super_block *, struct fstrim_range *);
+
+ /* 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);
sles12sp2/ext4-give-warning-with-dir-htree-growing.patch
sles12sp2/ext4-mmp-brelse.patch
rhel7/ext4-jcb-optimization.patch
+sles12sp2/ext4-attach-jinode-in-writepages.patch
struct inode *osd_iget(struct osd_thread_info *info, struct osd_device *dev,
struct osd_inode_id *id)
{
+ int rc;
struct inode *inode = NULL;
/* if we look for an inode withing a running
LDISKFS_SB(osd_sb(dev))->s_es->s_volume_name, id->oii_ino);
iput(inode);
inode = ERR_PTR(-ENOENT);
+ } else if ((rc = osd_attach_jinode(inode))) {
+ iput(inode);
+ inode = ERR_PTR(rc);
} else {
ldiskfs_clear_inode_state(inode, LDISKFS_STATE_LUSTRE_DESTROY);
if (id->oii_gen == OSD_OII_NOGEN)
(flags & SS_AUTO_PARTIAL || sf->sf_status == SS_SCANNING))
osd_check_lmv(info, dev, inode, oic);
+ result = osd_attach_jinode(inode);
+ if (result) {
+ obj->oo_inode = NULL;
+ iput(inode);
+ GOTO(out, result);
+ }
+
if (!ldiskfs_pdo)
GOTO(out, result = 0);
}
#endif
+#ifdef HAVE_LDISKFS_INFO_JINODE
+# define osd_attach_jinode(inode) ldiskfs_inode_attach_jinode(inode)
+#else /* HAVE_LDISKFS_INFO_JINODE */
+# define osd_attach_jinode(inode) 0
+#endif /* HAVE_LDISKFS_INFO_JINODE */
+
#ifdef LDISKFS_HT_MISC
# define osd_journal_start_sb(sb, type, nblock) \
ldiskfs_journal_start_sb(sb, type, nblock)
-# define osd_ldiskfs_append(handle, inode, nblock) \
- ldiskfs_append(handle, inode, nblock)
+static inline struct buffer_head *osd_ldiskfs_append(handle_t *handle,
+ struct inode *inode,
+ ldiskfs_lblk_t *nblock)
+{
+ int rc;
+
+ rc = osd_attach_jinode(inode);
+ if (rc)
+ return ERR_PTR(rc);
+ return ldiskfs_append(handle, inode, nblock);
+}
# define osd_ldiskfs_find_entry(dir, name, de, inlined, lock) \
(__ldiskfs_find_entry(dir, name, de, inlined, lock) ?: \
ERR_PTR(-ENOENT))
ldiskfs_lblk_t block,
int create)
{
-#ifdef HAVE_EXT4_BREAD_4ARGS
- return ldiskfs_bread(handle, inode, block, create);
-#else
+ int rc = 0;
struct buffer_head *bh;
- int error = 0;
- bh = ldiskfs_bread(handle, inode, block, create, &error);
- if (bh == NULL && error != 0)
- bh = ERR_PTR(error);
+ if (create) {
+ rc = osd_attach_jinode(inode);
+ if (rc)
+ return ERR_PTR(rc);
+ }
+#ifdef HAVE_EXT4_BREAD_4ARGS
+ bh = ldiskfs_bread(handle, inode, block, create);
+#else
- return bh;
+ bh = ldiskfs_bread(handle, inode, block, create, &rc);
+ if (bh == NULL && rc != 0)
+ bh = ERR_PTR(rc);
#endif
+ return bh;
}
void ldiskfs_inc_count(handle_t *handle, struct inode *inode);
void osd_fini_iobuf(struct osd_device *d, struct osd_iobuf *iobuf);
+
#endif /* _OSD_INTERNAL_H */
struct page *fp = NULL;
int clen = 0;
pgoff_t max_page_index;
+ handle_t *handle = NULL;
max_page_index = inode->i_sb->s_maxbytes >> PAGE_SHIFT;
CDEBUG(D_OTHER, "inode %lu: map %d pages from %lu\n",
inode->i_ino, pages, (*page)->index);
+ if (create) {
+ create = LDISKFS_GET_BLOCKS_CREATE;
+ handle = ldiskfs_journal_current_handle();
+ LASSERT(handle != NULL);
+ rc = osd_attach_jinode(inode);
+ if (rc)
+ return rc;
+ }
/* pages are sorted already. so, we just have to find
* contig. space and process them properly */
while (i < pages) {
long blen, total = 0;
- handle_t *handle = NULL;
struct ldiskfs_map_blocks map = { 0 };
if (fp == NULL) { /* start new extent */
/* process found extent */
map.m_lblk = fp->index * blocks_per_page;
map.m_len = blen = clen * blocks_per_page;
- if (create) {
- create = LDISKFS_GET_BLOCKS_CREATE;
- handle = ldiskfs_journal_current_handle();
- LASSERT(handle != NULL);
- }
cont_map:
rc = ldiskfs_map_blocks(handle, inode, &map, create);
if (rc >= 0) {