return ret;
}
-static int osd_extend_trans(handle_t *handle, int needed)
+#ifdef HAVE_LDISKFS_JOURNAL_ENSURE_CREDITS
+static int osd_extend_trans(handle_t *handle, int needed,
+ struct inode *inode)
+{
+ return __ldiskfs_journal_ensure_credits(handle, needed, needed,
+ ldiskfs_trans_default_revoke_credits(inode->i_sb));
+}
+
+static int osd_extend_restart_trans(handle_t *handle, int needed,
+ struct inode *inode)
+{
+ return ldiskfs_journal_ensure_credits(handle, needed,
+ ldiskfs_trans_default_revoke_credits(inode->i_sb));
+}
+#else
+static int osd_extend_trans(handle_t *handle, int needed,
+ struct inode *inode)
{
if (ldiskfs_handle_has_enough_credits(handle, needed))
return 0;
needed - handle->h_buffer_credits);
}
-static int osd_extend_restart_trans(handle_t *handle, int needed)
+static int osd_extend_restart_trans(handle_t *handle, int needed,
+ struct inode *inode)
{
- int rc = osd_extend_trans(handle, needed);
+ int rc = osd_extend_trans(handle, needed, inode);
if (rc <= 0)
return rc;
return ldiskfs_journal_restart(handle, needed);
}
+#endif /* HAVE_LDISKFS_JOURNAL_ENSURE_CREDITS */
static int osd_ldiskfs_map_write(struct inode *inode, struct osd_iobuf *iobuf,
struct osd_device *osd, sector_t start_blocks,
* credits to insert 1 extent into extent tree.
*/
credits = osd_chunk_trans_blocks(inode, blen);
- rc = osd_extend_trans(handle, credits);
+ rc = osd_extend_trans(handle, credits, inode);
if (rc < 0)
GOTO(cleanup, rc);
/*
count, &disk_size, user_size);
if (rc)
GOTO(cleanup, rc);
+#ifdef HAVE_LDISKFS_JOURNAL_ENSURE_CREDITS
+ rc = ldiskfs_journal_restart(handle, credits,
+ ldiskfs_trans_default_revoke_credits(inode->i_sb));
+#else
rc = ldiskfs_journal_restart(handle, credits);
+#endif
if (rc)
GOTO(cleanup, rc);
start_blocks += count;
handle_t *handle = ldiskfs_journal_current_handle();
LASSERT(handle != NULL);
- rc = osd_extend_restart_trans(handle, save_credits);
+ rc = osd_extend_restart_trans(handle, save_credits,
+ inode);
}
} else {
/* no pages to write, no transno is needed */
}
/* TODO: quota check */
- rc = osd_extend_restart_trans(handle, credits);
+ rc = osd_extend_restart_trans(handle, credits, inode);
if (rc)
break;
}
out:
- inode_unlock(inode);
-
/* extand credits if needed for operations such as attribute set */
if (rc >= 0)
- rc = osd_extend_restart_trans(handle, save_credits);
+ rc = osd_extend_restart_trans(handle, save_credits, inode);
+
+ inode_unlock(inode);
RETURN(rc);
}