Commit 651857a1 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mfasheh/ocfs2

* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mfasheh/ocfs2: (31 commits)
  ocfs2: implement i_op->permission
  configfs: make configfs_dirent_exists() static
  ocfs2: update file system paths to set atime
  ocfs2: core atime update functions
  ocfs2: Add splice support
  ocfs2: Remove ocfs2_write_should_remove_suid()
  [PATCH] Export should_remove_suid()
  configfs: mutex_lock_nested() fix
  ocfs2: Remove struct ocfs2_journal_handle in favor of handle_t
  ocfs2: remove handle argument to ocfs2_start_trans()
  ocfs2: remove ocfs2_journal_handle journal field
  ocfs2: pass ocfs2_super * into ocfs2_commit_trans()
  ocfs2: remove unused handle argument from ocfs2_meta_lock_full()
  ocfs2: make ocfs2_alloc_handle() static
  ocfs2: remove unused ocfs2_handle_add_lock()
  ocfs2: remove unused ocfs2_handle_add_inode()
  ocfs2: Don't allocate handle early in ocfs2_rename()
  ocfs2: don't use handle for locking in allocation functions
  ocfs2: don't pass handle to ocfs2_meta_lock in ocfs2_rename()
  ocfs2: don't pass handle to ocfs2_meta_lock in ocfs2_symlink()
  ...
parents ee28b0da d38eb8db
...@@ -93,7 +93,7 @@ static struct configfs_dirent *configfs_new_dirent(struct configfs_dirent * pare ...@@ -93,7 +93,7 @@ static struct configfs_dirent *configfs_new_dirent(struct configfs_dirent * pare
* *
* called with parent inode's i_mutex held * called with parent inode's i_mutex held
*/ */
int configfs_dirent_exists(struct configfs_dirent *parent_sd, static int configfs_dirent_exists(struct configfs_dirent *parent_sd,
const unsigned char *new) const unsigned char *new)
{ {
struct configfs_dirent * sd; struct configfs_dirent * sd;
...@@ -1176,8 +1176,9 @@ void configfs_unregister_subsystem(struct configfs_subsystem *subsys) ...@@ -1176,8 +1176,9 @@ void configfs_unregister_subsystem(struct configfs_subsystem *subsys)
return; return;
} }
mutex_lock(&configfs_sb->s_root->d_inode->i_mutex); mutex_lock_nested(&configfs_sb->s_root->d_inode->i_mutex,
mutex_lock(&dentry->d_inode->i_mutex); I_MUTEX_PARENT);
mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_CHILD);
if (configfs_detach_prep(dentry)) { if (configfs_detach_prep(dentry)) {
printk(KERN_ERR "configfs: Tried to unregister non-empty subsystem!\n"); printk(KERN_ERR "configfs: Tried to unregister non-empty subsystem!\n");
} }
......
...@@ -52,14 +52,14 @@ static int ocfs2_extent_contig(struct inode *inode, ...@@ -52,14 +52,14 @@ static int ocfs2_extent_contig(struct inode *inode,
u64 blkno); u64 blkno);
static int ocfs2_create_new_meta_bhs(struct ocfs2_super *osb, static int ocfs2_create_new_meta_bhs(struct ocfs2_super *osb,
struct ocfs2_journal_handle *handle, handle_t *handle,
struct inode *inode, struct inode *inode,
int wanted, int wanted,
struct ocfs2_alloc_context *meta_ac, struct ocfs2_alloc_context *meta_ac,
struct buffer_head *bhs[]); struct buffer_head *bhs[]);
static int ocfs2_add_branch(struct ocfs2_super *osb, static int ocfs2_add_branch(struct ocfs2_super *osb,
struct ocfs2_journal_handle *handle, handle_t *handle,
struct inode *inode, struct inode *inode,
struct buffer_head *fe_bh, struct buffer_head *fe_bh,
struct buffer_head *eb_bh, struct buffer_head *eb_bh,
...@@ -67,14 +67,14 @@ static int ocfs2_add_branch(struct ocfs2_super *osb, ...@@ -67,14 +67,14 @@ static int ocfs2_add_branch(struct ocfs2_super *osb,
struct ocfs2_alloc_context *meta_ac); struct ocfs2_alloc_context *meta_ac);
static int ocfs2_shift_tree_depth(struct ocfs2_super *osb, static int ocfs2_shift_tree_depth(struct ocfs2_super *osb,
struct ocfs2_journal_handle *handle, handle_t *handle,
struct inode *inode, struct inode *inode,
struct buffer_head *fe_bh, struct buffer_head *fe_bh,
struct ocfs2_alloc_context *meta_ac, struct ocfs2_alloc_context *meta_ac,
struct buffer_head **ret_new_eb_bh); struct buffer_head **ret_new_eb_bh);
static int ocfs2_do_insert_extent(struct ocfs2_super *osb, static int ocfs2_do_insert_extent(struct ocfs2_super *osb,
struct ocfs2_journal_handle *handle, handle_t *handle,
struct inode *inode, struct inode *inode,
struct buffer_head *fe_bh, struct buffer_head *fe_bh,
u64 blkno, u64 blkno,
...@@ -152,7 +152,7 @@ int ocfs2_num_free_extents(struct ocfs2_super *osb, ...@@ -152,7 +152,7 @@ int ocfs2_num_free_extents(struct ocfs2_super *osb,
* l_count for you * l_count for you
*/ */
static int ocfs2_create_new_meta_bhs(struct ocfs2_super *osb, static int ocfs2_create_new_meta_bhs(struct ocfs2_super *osb,
struct ocfs2_journal_handle *handle, handle_t *handle,
struct inode *inode, struct inode *inode,
int wanted, int wanted,
struct ocfs2_alloc_context *meta_ac, struct ocfs2_alloc_context *meta_ac,
...@@ -253,7 +253,7 @@ static int ocfs2_create_new_meta_bhs(struct ocfs2_super *osb, ...@@ -253,7 +253,7 @@ static int ocfs2_create_new_meta_bhs(struct ocfs2_super *osb,
* contain a single record with e_clusters == 0. * contain a single record with e_clusters == 0.
*/ */
static int ocfs2_add_branch(struct ocfs2_super *osb, static int ocfs2_add_branch(struct ocfs2_super *osb,
struct ocfs2_journal_handle *handle, handle_t *handle,
struct inode *inode, struct inode *inode,
struct buffer_head *fe_bh, struct buffer_head *fe_bh,
struct buffer_head *eb_bh, struct buffer_head *eb_bh,
...@@ -418,7 +418,7 @@ static int ocfs2_add_branch(struct ocfs2_super *osb, ...@@ -418,7 +418,7 @@ static int ocfs2_add_branch(struct ocfs2_super *osb,
* after this call. * after this call.
*/ */
static int ocfs2_shift_tree_depth(struct ocfs2_super *osb, static int ocfs2_shift_tree_depth(struct ocfs2_super *osb,
struct ocfs2_journal_handle *handle, handle_t *handle,
struct inode *inode, struct inode *inode,
struct buffer_head *fe_bh, struct buffer_head *fe_bh,
struct ocfs2_alloc_context *meta_ac, struct ocfs2_alloc_context *meta_ac,
...@@ -520,7 +520,7 @@ static int ocfs2_shift_tree_depth(struct ocfs2_super *osb, ...@@ -520,7 +520,7 @@ static int ocfs2_shift_tree_depth(struct ocfs2_super *osb,
* down. * down.
*/ */
static int ocfs2_do_insert_extent(struct ocfs2_super *osb, static int ocfs2_do_insert_extent(struct ocfs2_super *osb,
struct ocfs2_journal_handle *handle, handle_t *handle,
struct inode *inode, struct inode *inode,
struct buffer_head *fe_bh, struct buffer_head *fe_bh,
u64 start_blk, u64 start_blk,
...@@ -809,7 +809,7 @@ static int ocfs2_find_branch_target(struct ocfs2_super *osb, ...@@ -809,7 +809,7 @@ static int ocfs2_find_branch_target(struct ocfs2_super *osb,
/* the caller needs to update fe->i_clusters */ /* the caller needs to update fe->i_clusters */
int ocfs2_insert_extent(struct ocfs2_super *osb, int ocfs2_insert_extent(struct ocfs2_super *osb,
struct ocfs2_journal_handle *handle, handle_t *handle,
struct inode *inode, struct inode *inode,
struct buffer_head *fe_bh, struct buffer_head *fe_bh,
u64 start_blk, u64 start_blk,
...@@ -951,7 +951,7 @@ static int ocfs2_truncate_log_can_coalesce(struct ocfs2_truncate_log *tl, ...@@ -951,7 +951,7 @@ static int ocfs2_truncate_log_can_coalesce(struct ocfs2_truncate_log *tl,
} }
static int ocfs2_truncate_log_append(struct ocfs2_super *osb, static int ocfs2_truncate_log_append(struct ocfs2_super *osb,
struct ocfs2_journal_handle *handle, handle_t *handle,
u64 start_blk, u64 start_blk,
unsigned int num_clusters) unsigned int num_clusters)
{ {
...@@ -1034,7 +1034,7 @@ static int ocfs2_truncate_log_append(struct ocfs2_super *osb, ...@@ -1034,7 +1034,7 @@ static int ocfs2_truncate_log_append(struct ocfs2_super *osb,
} }
static int ocfs2_replay_truncate_records(struct ocfs2_super *osb, static int ocfs2_replay_truncate_records(struct ocfs2_super *osb,
struct ocfs2_journal_handle *handle, handle_t *handle,
struct inode *data_alloc_inode, struct inode *data_alloc_inode,
struct buffer_head *data_alloc_bh) struct buffer_head *data_alloc_bh)
{ {
...@@ -1113,7 +1113,7 @@ static int __ocfs2_flush_truncate_log(struct ocfs2_super *osb) ...@@ -1113,7 +1113,7 @@ static int __ocfs2_flush_truncate_log(struct ocfs2_super *osb)
{ {
int status; int status;
unsigned int num_to_flush; unsigned int num_to_flush;
struct ocfs2_journal_handle *handle = NULL; handle_t *handle;
struct inode *tl_inode = osb->osb_tl_inode; struct inode *tl_inode = osb->osb_tl_inode;
struct inode *data_alloc_inode = NULL; struct inode *data_alloc_inode = NULL;
struct buffer_head *tl_bh = osb->osb_tl_bh; struct buffer_head *tl_bh = osb->osb_tl_bh;
...@@ -1130,7 +1130,7 @@ static int __ocfs2_flush_truncate_log(struct ocfs2_super *osb) ...@@ -1130,7 +1130,7 @@ static int __ocfs2_flush_truncate_log(struct ocfs2_super *osb)
if (!OCFS2_IS_VALID_DINODE(di)) { if (!OCFS2_IS_VALID_DINODE(di)) {
OCFS2_RO_ON_INVALID_DINODE(osb->sb, di); OCFS2_RO_ON_INVALID_DINODE(osb->sb, di);
status = -EIO; status = -EIO;
goto bail; goto out;
} }
num_to_flush = le16_to_cpu(tl->tl_used); num_to_flush = le16_to_cpu(tl->tl_used);
...@@ -1138,14 +1138,7 @@ static int __ocfs2_flush_truncate_log(struct ocfs2_super *osb) ...@@ -1138,14 +1138,7 @@ static int __ocfs2_flush_truncate_log(struct ocfs2_super *osb)
num_to_flush, (unsigned long long)OCFS2_I(tl_inode)->ip_blkno); num_to_flush, (unsigned long long)OCFS2_I(tl_inode)->ip_blkno);
if (!num_to_flush) { if (!num_to_flush) {
status = 0; status = 0;
goto bail; goto out;
}
handle = ocfs2_alloc_handle(osb);
if (!handle) {
status = -ENOMEM;
mlog_errno(status);
goto bail;
} }
data_alloc_inode = ocfs2_get_system_file_inode(osb, data_alloc_inode = ocfs2_get_system_file_inode(osb,
...@@ -1154,41 +1147,40 @@ static int __ocfs2_flush_truncate_log(struct ocfs2_super *osb) ...@@ -1154,41 +1147,40 @@ static int __ocfs2_flush_truncate_log(struct ocfs2_super *osb)
if (!data_alloc_inode) { if (!data_alloc_inode) {
status = -EINVAL; status = -EINVAL;
mlog(ML_ERROR, "Could not get bitmap inode!\n"); mlog(ML_ERROR, "Could not get bitmap inode!\n");
goto bail; goto out;
} }
ocfs2_handle_add_inode(handle, data_alloc_inode); mutex_lock(&data_alloc_inode->i_mutex);
status = ocfs2_meta_lock(data_alloc_inode, handle, &data_alloc_bh, 1);
status = ocfs2_meta_lock(data_alloc_inode, &data_alloc_bh, 1);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
goto bail; goto out_mutex;
} }
handle = ocfs2_start_trans(osb, handle, OCFS2_TRUNCATE_LOG_UPDATE); handle = ocfs2_start_trans(osb, OCFS2_TRUNCATE_LOG_UPDATE);
if (IS_ERR(handle)) { if (IS_ERR(handle)) {
status = PTR_ERR(handle); status = PTR_ERR(handle);
handle = NULL;
mlog_errno(status); mlog_errno(status);
goto bail; goto out_unlock;
} }
status = ocfs2_replay_truncate_records(osb, handle, data_alloc_inode, status = ocfs2_replay_truncate_records(osb, handle, data_alloc_inode,
data_alloc_bh); data_alloc_bh);
if (status < 0) { if (status < 0)
mlog_errno(status); mlog_errno(status);
goto bail;
}
bail: ocfs2_commit_trans(osb, handle);
if (handle)
ocfs2_commit_trans(handle);
if (data_alloc_inode)
iput(data_alloc_inode);
if (data_alloc_bh) out_unlock:
brelse(data_alloc_bh); brelse(data_alloc_bh);
ocfs2_meta_unlock(data_alloc_inode, 1);
out_mutex:
mutex_unlock(&data_alloc_inode->i_mutex);
iput(data_alloc_inode);
out:
mlog_exit(status); mlog_exit(status);
return status; return status;
} }
...@@ -1347,7 +1339,7 @@ int ocfs2_complete_truncate_log_recovery(struct ocfs2_super *osb, ...@@ -1347,7 +1339,7 @@ int ocfs2_complete_truncate_log_recovery(struct ocfs2_super *osb,
int i; int i;
unsigned int clusters, num_recs, start_cluster; unsigned int clusters, num_recs, start_cluster;
u64 start_blk; u64 start_blk;
struct ocfs2_journal_handle *handle; handle_t *handle;
struct inode *tl_inode = osb->osb_tl_inode; struct inode *tl_inode = osb->osb_tl_inode;
struct ocfs2_truncate_log *tl; struct ocfs2_truncate_log *tl;
...@@ -1373,8 +1365,7 @@ int ocfs2_complete_truncate_log_recovery(struct ocfs2_super *osb, ...@@ -1373,8 +1365,7 @@ int ocfs2_complete_truncate_log_recovery(struct ocfs2_super *osb,
} }
} }
handle = ocfs2_start_trans(osb, NULL, handle = ocfs2_start_trans(osb, OCFS2_TRUNCATE_LOG_UPDATE);
OCFS2_TRUNCATE_LOG_UPDATE);
if (IS_ERR(handle)) { if (IS_ERR(handle)) {
status = PTR_ERR(handle); status = PTR_ERR(handle);
mlog_errno(status); mlog_errno(status);
...@@ -1387,7 +1378,7 @@ int ocfs2_complete_truncate_log_recovery(struct ocfs2_super *osb, ...@@ -1387,7 +1378,7 @@ int ocfs2_complete_truncate_log_recovery(struct ocfs2_super *osb,
status = ocfs2_truncate_log_append(osb, handle, status = ocfs2_truncate_log_append(osb, handle,
start_blk, clusters); start_blk, clusters);
ocfs2_commit_trans(handle); ocfs2_commit_trans(osb, handle);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
goto bail_up; goto bail_up;
...@@ -1543,7 +1534,7 @@ static int ocfs2_do_truncate(struct ocfs2_super *osb, ...@@ -1543,7 +1534,7 @@ static int ocfs2_do_truncate(struct ocfs2_super *osb,
struct inode *inode, struct inode *inode,
struct buffer_head *fe_bh, struct buffer_head *fe_bh,
struct buffer_head *old_last_eb_bh, struct buffer_head *old_last_eb_bh,
struct ocfs2_journal_handle *handle, handle_t *handle,
struct ocfs2_truncate_context *tc) struct ocfs2_truncate_context *tc)
{ {
int status, i, depth; int status, i, depth;
...@@ -1782,7 +1773,7 @@ int ocfs2_commit_truncate(struct ocfs2_super *osb, ...@@ -1782,7 +1773,7 @@ int ocfs2_commit_truncate(struct ocfs2_super *osb,
struct ocfs2_extent_block *eb; struct ocfs2_extent_block *eb;
struct ocfs2_extent_list *el; struct ocfs2_extent_list *el;
struct buffer_head *last_eb_bh; struct buffer_head *last_eb_bh;
struct ocfs2_journal_handle *handle = NULL; handle_t *handle = NULL;
struct inode *tl_inode = osb->osb_tl_inode; struct inode *tl_inode = osb->osb_tl_inode;
mlog_entry_void(); mlog_entry_void();
...@@ -1868,7 +1859,7 @@ int ocfs2_commit_truncate(struct ocfs2_super *osb, ...@@ -1868,7 +1859,7 @@ int ocfs2_commit_truncate(struct ocfs2_super *osb,
credits = ocfs2_calc_tree_trunc_credits(osb->sb, clusters_to_del, credits = ocfs2_calc_tree_trunc_credits(osb->sb, clusters_to_del,
fe, el); fe, el);
handle = ocfs2_start_trans(osb, NULL, credits); handle = ocfs2_start_trans(osb, credits);
if (IS_ERR(handle)) { if (IS_ERR(handle)) {
status = PTR_ERR(handle); status = PTR_ERR(handle);
handle = NULL; handle = NULL;
...@@ -1891,7 +1882,7 @@ int ocfs2_commit_truncate(struct ocfs2_super *osb, ...@@ -1891,7 +1882,7 @@ int ocfs2_commit_truncate(struct ocfs2_super *osb,
mutex_unlock(&tl_inode->i_mutex); mutex_unlock(&tl_inode->i_mutex);
tl_sem = 0; tl_sem = 0;
ocfs2_commit_trans(handle); ocfs2_commit_trans(osb, handle);
handle = NULL; handle = NULL;
BUG_ON(le32_to_cpu(fe->i_clusters) < target_i_clusters); BUG_ON(le32_to_cpu(fe->i_clusters) < target_i_clusters);
...@@ -1906,7 +1897,7 @@ int ocfs2_commit_truncate(struct ocfs2_super *osb, ...@@ -1906,7 +1897,7 @@ int ocfs2_commit_truncate(struct ocfs2_super *osb,
mutex_unlock(&tl_inode->i_mutex); mutex_unlock(&tl_inode->i_mutex);
if (handle) if (handle)
ocfs2_commit_trans(handle); ocfs2_commit_trans(osb, handle);
if (last_eb_bh) if (last_eb_bh)
brelse(last_eb_bh); brelse(last_eb_bh);
...@@ -2011,10 +2002,7 @@ int ocfs2_prepare_truncate(struct ocfs2_super *osb, ...@@ -2011,10 +2002,7 @@ int ocfs2_prepare_truncate(struct ocfs2_super *osb,
mutex_lock(&ext_alloc_inode->i_mutex); mutex_lock(&ext_alloc_inode->i_mutex);
(*tc)->tc_ext_alloc_inode = ext_alloc_inode; (*tc)->tc_ext_alloc_inode = ext_alloc_inode;
status = ocfs2_meta_lock(ext_alloc_inode, status = ocfs2_meta_lock(ext_alloc_inode, &ext_alloc_bh, 1);
NULL,
&ext_alloc_bh,
1);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
goto bail; goto bail;
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
struct ocfs2_alloc_context; struct ocfs2_alloc_context;
int ocfs2_insert_extent(struct ocfs2_super *osb, int ocfs2_insert_extent(struct ocfs2_super *osb,
struct ocfs2_journal_handle *handle, handle_t *handle,
struct inode *inode, struct inode *inode,
struct buffer_head *fe_bh, struct buffer_head *fe_bh,
u64 blkno, u64 blkno,
......
...@@ -200,7 +200,7 @@ static int ocfs2_readpage(struct file *file, struct page *page) ...@@ -200,7 +200,7 @@ static int ocfs2_readpage(struct file *file, struct page *page)
mlog_entry("(0x%p, %lu)\n", file, (page ? page->index : 0)); mlog_entry("(0x%p, %lu)\n", file, (page ? page->index : 0));
ret = ocfs2_meta_lock_with_page(inode, NULL, NULL, 0, page); ret = ocfs2_meta_lock_with_page(inode, NULL, 0, page);
if (ret != 0) { if (ret != 0) {
if (ret == AOP_TRUNCATED_PAGE) if (ret == AOP_TRUNCATED_PAGE)
unlock = 0; unlock = 0;
...@@ -305,7 +305,7 @@ static int ocfs2_prepare_write(struct file *file, struct page *page, ...@@ -305,7 +305,7 @@ static int ocfs2_prepare_write(struct file *file, struct page *page,
mlog_entry("(0x%p, 0x%p, %u, %u)\n", file, page, from, to); mlog_entry("(0x%p, 0x%p, %u, %u)\n", file, page, from, to);
ret = ocfs2_meta_lock_with_page(inode, NULL, NULL, 0, page); ret = ocfs2_meta_lock_with_page(inode, NULL, 0, page);
if (ret != 0) { if (ret != 0) {
mlog_errno(ret); mlog_errno(ret);
goto out; goto out;
...@@ -355,16 +355,16 @@ static int walk_page_buffers( handle_t *handle, ...@@ -355,16 +355,16 @@ static int walk_page_buffers( handle_t *handle,
return ret; return ret;
} }
struct ocfs2_journal_handle *ocfs2_start_walk_page_trans(struct inode *inode, handle_t *ocfs2_start_walk_page_trans(struct inode *inode,
struct page *page, struct page *page,
unsigned from, unsigned from,
unsigned to) unsigned to)
{ {
struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
struct ocfs2_journal_handle *handle = NULL; handle_t *handle = NULL;
int ret = 0; int ret = 0;
handle = ocfs2_start_trans(osb, NULL, OCFS2_INODE_UPDATE_CREDITS); handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS);
if (!handle) { if (!handle) {
ret = -ENOMEM; ret = -ENOMEM;
mlog_errno(ret); mlog_errno(ret);
...@@ -372,7 +372,7 @@ struct ocfs2_journal_handle *ocfs2_start_walk_page_trans(struct inode *inode, ...@@ -372,7 +372,7 @@ struct ocfs2_journal_handle *ocfs2_start_walk_page_trans(struct inode *inode,
} }
if (ocfs2_should_order_data(inode)) { if (ocfs2_should_order_data(inode)) {
ret = walk_page_buffers(handle->k_handle, ret = walk_page_buffers(handle,
page_buffers(page), page_buffers(page),
from, to, NULL, from, to, NULL,
ocfs2_journal_dirty_data); ocfs2_journal_dirty_data);
...@@ -382,7 +382,7 @@ struct ocfs2_journal_handle *ocfs2_start_walk_page_trans(struct inode *inode, ...@@ -382,7 +382,7 @@ struct ocfs2_journal_handle *ocfs2_start_walk_page_trans(struct inode *inode,
out: out:
if (ret) { if (ret) {
if (handle) if (handle)
ocfs2_commit_trans(handle); ocfs2_commit_trans(osb, handle);
handle = ERR_PTR(ret); handle = ERR_PTR(ret);
} }
return handle; return handle;
...@@ -394,7 +394,7 @@ static int ocfs2_commit_write(struct file *file, struct page *page, ...@@ -394,7 +394,7 @@ static int ocfs2_commit_write(struct file *file, struct page *page,
int ret; int ret;
struct buffer_head *di_bh = NULL; struct buffer_head *di_bh = NULL;
struct inode *inode = page->mapping->host; struct inode *inode = page->mapping->host;
struct ocfs2_journal_handle *handle = NULL; handle_t *handle = NULL;
struct ocfs2_dinode *di; struct ocfs2_dinode *di;
mlog_entry("(0x%p, 0x%p, %u, %u)\n", file, page, from, to); mlog_entry("(0x%p, 0x%p, %u, %u)\n", file, page, from, to);
...@@ -412,7 +412,7 @@ static int ocfs2_commit_write(struct file *file, struct page *page, ...@@ -412,7 +412,7 @@ static int ocfs2_commit_write(struct file *file, struct page *page,
* stale inode allocation image (i_size, i_clusters, etc). * stale inode allocation image (i_size, i_clusters, etc).
*/ */
ret = ocfs2_meta_lock_with_page(inode, NULL, &di_bh, 1, page); ret = ocfs2_meta_lock_with_page(inode, &di_bh, 1, page);
if (ret != 0) { if (ret != 0) {
mlog_errno(ret); mlog_errno(ret);
goto out; goto out;
...@@ -464,7 +464,7 @@ static int ocfs2_commit_write(struct file *file, struct page *page, ...@@ -464,7 +464,7 @@ static int ocfs2_commit_write(struct file *file, struct page *page,
} }
out_commit: out_commit:
ocfs2_commit_trans(handle); ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle);
out_unlock_data: out_unlock_data:
ocfs2_data_unlock(inode, 1); ocfs2_data_unlock(inode, 1);
out_unlock_meta: out_unlock_meta:
...@@ -490,7 +490,7 @@ static sector_t ocfs2_bmap(struct address_space *mapping, sector_t block) ...@@ -490,7 +490,7 @@ static sector_t ocfs2_bmap(struct address_space *mapping, sector_t block)
* accessed concurrently from multiple nodes. * accessed concurrently from multiple nodes.
*/ */
if (!INODE_JOURNAL(inode)) { if (!INODE_JOURNAL(inode)) {
err = ocfs2_meta_lock(inode, NULL, NULL, 0); err = ocfs2_meta_lock(inode, NULL, 0);
if (err) { if (err) {
if (err != -ENOENT) if (err != -ENOENT)
mlog_errno(err); mlog_errno(err);
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
int ocfs2_prepare_write_nolock(struct inode *inode, struct page *page, int ocfs2_prepare_write_nolock(struct inode *inode, struct page *page,
unsigned from, unsigned to); unsigned from, unsigned to);
struct ocfs2_journal_handle *ocfs2_start_walk_page_trans(struct inode *inode, handle_t *ocfs2_start_walk_page_trans(struct inode *inode,
struct page *page, struct page *page,
unsigned from, unsigned from,
unsigned to); unsigned to);
......
...@@ -82,6 +82,7 @@ int ocfs2_readdir(struct file * filp, void * dirent, filldir_t filldir) ...@@ -82,6 +82,7 @@ int ocfs2_readdir(struct file * filp, void * dirent, filldir_t filldir)
struct inode *inode = filp->f_dentry->d_inode; struct inode *inode = filp->f_dentry->d_inode;
struct super_block * sb = inode->i_sb; struct super_block * sb = inode->i_sb;
unsigned int ra_sectors = 16; unsigned int ra_sectors = 16;
int lock_level = 0;
mlog_entry("dirino=%llu\n", mlog_entry("dirino=%llu\n",
(unsigned long long)OCFS2_I(inode)->ip_blkno); (unsigned long long)OCFS2_I(inode)->ip_blkno);
...@@ -89,7 +90,15 @@ int ocfs2_readdir(struct file * filp, void * dirent, filldir_t filldir) ...@@ -89,7 +90,15 @@ int ocfs2_readdir(struct file * filp, void * dirent, filldir_t filldir)
stored = 0; stored = 0;
bh = NULL; bh = NULL;
error = ocfs2_meta_lock(inode, NULL, NULL, 0); error = ocfs2_meta_lock_atime(inode, filp->f_vfsmnt, &lock_level);
if (lock_level && error >= 0) {
/* We release EX lock which used to update atime
* and get PR lock again to reduce contention
* on commonly accessed directories. */
ocfs2_meta_unlock(inode, 1);
lock_level = 0;
error = ocfs2_meta_lock(inode, NULL, 0);
}
if (error < 0) { if (error < 0) {
if (error != -ENOENT) if (error != -ENOENT)
mlog_errno(error); mlog_errno(error);
...@@ -198,7 +207,7 @@ int ocfs2_readdir(struct file * filp, void * dirent, filldir_t filldir) ...@@ -198,7 +207,7 @@ int ocfs2_readdir(struct file * filp, void * dirent, filldir_t filldir)
stored = 0; stored = 0;
bail: bail:
ocfs2_meta_unlock(inode, 0); ocfs2_meta_unlock(inode, lock_level);
bail_nolock: bail_nolock:
mlog_exit(stored); mlog_exit(stored);
...@@ -340,7 +349,7 @@ int ocfs2_empty_dir(struct inode *inode) ...@@ -340,7 +349,7 @@ int ocfs2_empty_dir(struct inode *inode)
/* returns a bh of the 1st new block in the allocation. */ /* returns a bh of the 1st new block in the allocation. */
int ocfs2_do_extend_dir(struct super_block *sb, int ocfs2_do_extend_dir(struct super_block *sb,
struct ocfs2_journal_handle *handle, handle_t *handle,
struct inode *dir, struct inode *dir,
struct buffer_head *parent_fe_bh, struct buffer_head *parent_fe_bh,
struct ocfs2_alloc_context *data_ac, struct ocfs2_alloc_context *data_ac,
...@@ -398,7 +407,7 @@ static int ocfs2_extend_dir(struct ocfs2_super *osb, ...@@ -398,7 +407,7 @@ static int ocfs2_extend_dir(struct ocfs2_super *osb,
struct ocfs2_dinode *fe = (struct ocfs2_dinode *) parent_fe_bh->b_data; struct ocfs2_dinode *fe = (struct ocfs2_dinode *) parent_fe_bh->b_data;
struct ocfs2_alloc_context *data_ac = NULL; struct ocfs2_alloc_context *data_ac = NULL;
struct ocfs2_alloc_context *meta_ac = NULL; struct ocfs2_alloc_context *meta_ac = NULL;
struct ocfs2_journal_handle *handle = NULL; handle_t *handle = NULL;
struct buffer_head *new_bh = NULL; struct buffer_head *new_bh = NULL;
struct ocfs2_dir_entry * de; struct ocfs2_dir_entry * de;
struct super_block *sb = osb->sb; struct super_block *sb = osb->sb;
...@@ -409,13 +418,6 @@ static int ocfs2_extend_dir(struct ocfs2_super *osb, ...@@ -409,13 +418,6 @@ static int ocfs2_extend_dir(struct ocfs2_super *osb,
mlog(0, "extending dir %llu (i_size = %lld)\n", mlog(0, "extending dir %llu (i_size = %lld)\n",
(unsigned long long)OCFS2_I(dir)->ip_blkno, dir_i_size); (unsigned long long)OCFS2_I(dir)->ip_blkno, dir_i_size);
handle = ocfs2_alloc_handle(osb);
if (handle == NULL) {
status = -ENOMEM;
mlog_errno(status);
goto bail;
}
/* dir->i_size is always block aligned. */ /* dir->i_size is always block aligned. */
spin_lock(&OCFS2_I(dir)->ip_lock); spin_lock(&OCFS2_I(dir)->ip_lock);
if (dir_i_size == ocfs2_clusters_to_bytes(sb, OCFS2_I(dir)->ip_clusters)) { if (dir_i_size == ocfs2_clusters_to_bytes(sb, OCFS2_I(dir)->ip_clusters)) {
...@@ -428,8 +430,7 @@ static int ocfs2_extend_dir(struct ocfs2_super *osb, ...@@ -428,8 +430,7 @@ static int ocfs2_extend_dir(struct ocfs2_super *osb,
} }
if (!num_free_extents) { if (!num_free_extents) {
status = ocfs2_reserve_new_metadata(osb, handle, status = ocfs2_reserve_new_metadata(osb, fe, &meta_ac);
fe, &meta_ac);
if (status < 0) { if (status < 0) {
if (status != -ENOSPC) if (status != -ENOSPC)
mlog_errno(status); mlog_errno(status);
...@@ -437,7 +438,7 @@ static int ocfs2_extend_dir(struct ocfs2_super *osb, ...@@ -437,7 +438,7 @@ static int ocfs2_extend_dir(struct ocfs2_super *osb,
} }
} }
status = ocfs2_reserve_clusters(osb, handle, 1, &data_ac); status = ocfs2_reserve_clusters(osb, 1, &data_ac);
if (status < 0) { if (status < 0) {
if (status != -ENOSPC) if (status != -ENOSPC)
mlog_errno(status); mlog_errno(status);
...@@ -450,7 +451,7 @@ static int ocfs2_extend_dir(struct ocfs2_super *osb, ...@@ -450,7 +451,7 @@ static int ocfs2_extend_dir(struct ocfs2_super *osb,
credits = OCFS2_SIMPLE_DIR_EXTEND_CREDITS; credits = OCFS2_SIMPLE_DIR_EXTEND_CREDITS;
} }
handle = ocfs2_start_trans(osb, handle, credits); handle = ocfs2_start_trans(osb, credits);
if (IS_ERR(handle)) { if (IS_ERR(handle)) {
status = PTR_ERR(handle); status = PTR_ERR(handle);
handle = NULL; handle = NULL;
...@@ -496,7 +497,7 @@ static int ocfs2_extend_dir(struct ocfs2_super *osb, ...@@ -496,7 +497,7 @@ static int ocfs2_extend_dir(struct ocfs2_super *osb,
get_bh(*new_de_bh); get_bh(*new_de_bh);
bail: bail:
if (handle) if (handle)
ocfs2_commit_trans(handle); ocfs2_commit_trans(osb, handle);
if (data_ac) if (data_ac)
ocfs2_free_alloc_context(data_ac); ocfs2_free_alloc_context(data_ac);
......
...@@ -45,7 +45,7 @@ int ocfs2_prepare_dir_for_insert(struct ocfs2_super *osb, ...@@ -45,7 +45,7 @@ int ocfs2_prepare_dir_for_insert(struct ocfs2_super *osb,
struct buffer_head **ret_de_bh); struct buffer_head **ret_de_bh);
struct ocfs2_alloc_context; struct ocfs2_alloc_context;
int ocfs2_do_extend_dir(struct super_block *sb, int ocfs2_do_extend_dir(struct super_block *sb,
struct ocfs2_journal_handle *handle, handle_t *handle,
struct inode *dir, struct inode *dir,
struct buffer_head *parent_fe_bh, struct buffer_head *parent_fe_bh,
struct ocfs2_alloc_context *data_ac, struct ocfs2_alloc_context *data_ac,
......
...@@ -68,7 +68,8 @@ static void **dlm_alloc_pagevec(int pages) ...@@ -68,7 +68,8 @@ static void **dlm_alloc_pagevec(int pages)
goto out_free; goto out_free;
mlog(0, "Allocated DLM hash pagevec; %d pages (%lu expected), %lu buckets per page\n", mlog(0, "Allocated DLM hash pagevec; %d pages (%lu expected), %lu buckets per page\n",
pages, DLM_HASH_PAGES, (unsigned long)DLM_BUCKETS_PER_PAGE); pages, (unsigned long)DLM_HASH_PAGES,
(unsigned long)DLM_BUCKETS_PER_PAGE);
return vec; return vec;
out_free: out_free:
dlm_free_pagevec(vec, i); dlm_free_pagevec(vec, i);
......
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
#include "dcache.h" #include "dcache.h"
#include "dlmglue.h" #include "dlmglue.h"
#include "extent_map.h" #include "extent_map.h"
#include "file.h"
#include "heartbeat.h" #include "heartbeat.h"
#include "inode.h" #include "inode.h"
#include "journal.h" #include "journal.h"
...@@ -1063,7 +1064,7 @@ static void ocfs2_cluster_unlock(struct ocfs2_super *osb, ...@@ -1063,7 +1064,7 @@ static void ocfs2_cluster_unlock(struct ocfs2_super *osb,
mlog_exit_void(); mlog_exit_void();
} }
int ocfs2_create_new_lock(struct ocfs2_super *osb, static int ocfs2_create_new_lock(struct ocfs2_super *osb,
struct ocfs2_lock_res *lockres, struct ocfs2_lock_res *lockres,
int ex, int ex,
int local) int local)
...@@ -1579,7 +1580,6 @@ static int ocfs2_assign_bh(struct inode *inode, ...@@ -1579,7 +1580,6 @@ static int ocfs2_assign_bh(struct inode *inode,
* the result of the lock will be communicated via the callback. * the result of the lock will be communicated via the callback.
*/ */
int ocfs2_meta_lock_full(struct inode *inode, int ocfs2_meta_lock_full(struct inode *inode,
struct ocfs2_journal_handle *handle,
struct buffer_head **ret_bh, struct buffer_head **ret_bh,
int ex, int ex,
int arg_flags) int arg_flags)
...@@ -1668,12 +1668,6 @@ int ocfs2_meta_lock_full(struct inode *inode, ...@@ -1668,12 +1668,6 @@ int ocfs2_meta_lock_full(struct inode *inode,
} }
} }
if (handle) {
status = ocfs2_handle_add_lock(handle, inode);
if (status < 0)
mlog_errno(status);
}
bail: bail:
if (status < 0) { if (status < 0) {
if (ret_bh && (*ret_bh)) { if (ret_bh && (*ret_bh)) {
...@@ -1713,18 +1707,16 @@ int ocfs2_meta_lock_full(struct inode *inode, ...@@ -1713,18 +1707,16 @@ int ocfs2_meta_lock_full(struct inode *inode,
* the lock inversion simply. * the lock inversion simply.
*/ */
int ocfs2_meta_lock_with_page(struct inode *inode, int ocfs2_meta_lock_with_page(struct inode *inode,
struct ocfs2_journal_handle *handle,
struct buffer_head **ret_bh, struct buffer_head **ret_bh,
int ex, int ex,
struct page *page) struct page *page)
{ {
int ret; int ret;
ret = ocfs2_meta_lock_full(inode, handle, ret_bh, ex, ret = ocfs2_meta_lock_full(inode, ret_bh, ex, OCFS2_LOCK_NONBLOCK);
OCFS2_LOCK_NONBLOCK);
if (ret == -EAGAIN) { if (ret == -EAGAIN) {
unlock_page(page); unlock_page(page);
if (ocfs2_meta_lock(inode, handle, ret_bh, ex) == 0) if (ocfs2_meta_lock(inode, ret_bh, ex) == 0)
ocfs2_meta_unlock(inode, ex); ocfs2_meta_unlock(inode, ex);
ret = AOP_TRUNCATED_PAGE; ret = AOP_TRUNCATED_PAGE;
} }
...@@ -1732,6 +1724,44 @@ int ocfs2_meta_lock_with_page(struct inode *inode, ...@@ -1732,6 +1724,44 @@ int ocfs2_meta_lock_with_page(struct inode *inode,
return ret; return ret;
} }
int ocfs2_meta_lock_atime(struct inode *inode,
struct vfsmount *vfsmnt,
int *level)
{
int ret;
mlog_entry_void();
ret = ocfs2_meta_lock(inode, NULL, 0);
if (ret < 0) {
mlog_errno(ret);
return ret;
}
/*
* If we should update atime, we will get EX lock,
* otherwise we just get PR lock.
*/
if (ocfs2_should_update_atime(inode, vfsmnt)) {
struct buffer_head *bh = NULL;
ocfs2_meta_unlock(inode, 0);
ret = ocfs2_meta_lock(inode, &bh, 1);
if (ret < 0) {
mlog_errno(ret);
return ret;
}
*level = 1;
if (ocfs2_should_update_atime(inode, vfsmnt))
ocfs2_update_inode_atime(inode, bh);
if (bh)
brelse(bh);
} else
*level = 0;
mlog_exit(ret);
return ret;
}
void ocfs2_meta_unlock(struct inode *inode, void ocfs2_meta_unlock(struct inode *inode,
int ex) int ex)
{ {
......
...@@ -68,8 +68,6 @@ void ocfs2_dentry_lock_res_init(struct ocfs2_dentry_lock *dl, ...@@ -68,8 +68,6 @@ void ocfs2_dentry_lock_res_init(struct ocfs2_dentry_lock *dl,
u64 parent, struct inode *inode); u64 parent, struct inode *inode);
void ocfs2_lock_res_free(struct ocfs2_lock_res *res); void ocfs2_lock_res_free(struct ocfs2_lock_res *res);
int ocfs2_create_new_inode_locks(struct inode *inode); int ocfs2_create_new_inode_locks(struct inode *inode);
int ocfs2_create_new_lock(struct ocfs2_super *osb,
struct ocfs2_lock_res *lockres, int ex, int local);
int ocfs2_drop_inode_locks(struct inode *inode); int ocfs2_drop_inode_locks(struct inode *inode);
int ocfs2_data_lock_full(struct inode *inode, int ocfs2_data_lock_full(struct inode *inode,
int write, int write,
...@@ -82,19 +80,20 @@ void ocfs2_data_unlock(struct inode *inode, ...@@ -82,19 +80,20 @@ void ocfs2_data_unlock(struct inode *inode,
int write); int write);
int ocfs2_rw_lock(struct inode *inode, int write); int ocfs2_rw_lock(struct inode *inode, int write);
void ocfs2_rw_unlock(struct inode *inode, int write); void ocfs2_rw_unlock(struct inode *inode, int write);
int ocfs2_meta_lock_atime(struct inode *inode,
struct vfsmount *vfsmnt,
int *level);
int ocfs2_meta_lock_full(struct inode *inode, int ocfs2_meta_lock_full(struct inode *inode,
struct ocfs2_journal_handle *handle,
struct buffer_head **ret_bh, struct buffer_head **ret_bh,
int ex, int ex,
int arg_flags); int arg_flags);
int ocfs2_meta_lock_with_page(struct inode *inode, int ocfs2_meta_lock_with_page(struct inode *inode,
struct ocfs2_journal_handle *handle,
struct buffer_head **ret_bh, struct buffer_head **ret_bh,
int ex, int ex,
struct page *page); struct page *page);
/* 99% of the time we don't want to supply any additional flags -- /* 99% of the time we don't want to supply any additional flags --
* those are for very specific cases only. */ * those are for very specific cases only. */
#define ocfs2_meta_lock(i, h, b, e) ocfs2_meta_lock_full(i, h, b, e, 0) #define ocfs2_meta_lock(i, b, e) ocfs2_meta_lock_full(i, b, e, 0)
void ocfs2_meta_unlock(struct inode *inode, void ocfs2_meta_unlock(struct inode *inode,
int ex); int ex);
int ocfs2_super_lock(struct ocfs2_super *osb, int ocfs2_super_lock(struct ocfs2_super *osb,
......
...@@ -100,7 +100,7 @@ static struct dentry *ocfs2_get_parent(struct dentry *child) ...@@ -100,7 +100,7 @@ static struct dentry *ocfs2_get_parent(struct dentry *child)
mlog(0, "find parent of directory %llu\n", mlog(0, "find parent of directory %llu\n",
(unsigned long long)OCFS2_I(dir)->ip_blkno); (unsigned long long)OCFS2_I(dir)->ip_blkno);
status = ocfs2_meta_lock(dir, NULL, NULL, 0); status = ocfs2_meta_lock(dir, NULL, 0);
if (status < 0) { if (status < 0) {
if (status != -ENOENT) if (status != -ENOENT)
mlog_errno(status); mlog_errno(status);
......
This diff is collapsed.
...@@ -41,17 +41,24 @@ int ocfs2_do_extend_allocation(struct ocfs2_super *osb, ...@@ -41,17 +41,24 @@ int ocfs2_do_extend_allocation(struct ocfs2_super *osb,
struct inode *inode, struct inode *inode,
u32 clusters_to_add, u32 clusters_to_add,
struct buffer_head *fe_bh, struct buffer_head *fe_bh,
struct ocfs2_journal_handle *handle, handle_t *handle,
struct ocfs2_alloc_context *data_ac, struct ocfs2_alloc_context *data_ac,
struct ocfs2_alloc_context *meta_ac, struct ocfs2_alloc_context *meta_ac,
enum ocfs2_alloc_restarted *reason); enum ocfs2_alloc_restarted *reason);
int ocfs2_setattr(struct dentry *dentry, struct iattr *attr); int ocfs2_setattr(struct dentry *dentry, struct iattr *attr);
int ocfs2_getattr(struct vfsmount *mnt, struct dentry *dentry, int ocfs2_getattr(struct vfsmount *mnt, struct dentry *dentry,
struct kstat *stat); struct kstat *stat);
int ocfs2_permission(struct inode *inode, int mask,
struct nameidata *nd);
int ocfs2_set_inode_size(struct ocfs2_journal_handle *handle, int ocfs2_set_inode_size(handle_t *handle,
struct inode *inode, struct inode *inode,
struct buffer_head *fe_bh, struct buffer_head *fe_bh,
u64 new_i_size); u64 new_i_size);
int ocfs2_should_update_atime(struct inode *inode,
struct vfsmount *vfsmnt);
int ocfs2_update_inode_atime(struct inode *inode,
struct buffer_head *bh);
#endif /* OCFS2_FILE_H */ #endif /* OCFS2_FILE_H */
...@@ -360,7 +360,6 @@ int ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe, ...@@ -360,7 +360,6 @@ int ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe,
inode); inode);
ocfs2_set_inode_flags(inode); ocfs2_set_inode_flags(inode);
inode->i_flags |= S_NOATIME;
status = 0; status = 0;
bail: bail:
...@@ -441,7 +440,7 @@ static int ocfs2_read_locked_inode(struct inode *inode, ...@@ -441,7 +440,7 @@ static int ocfs2_read_locked_inode(struct inode *inode,
generation, inode); generation, inode);
if (can_lock) { if (can_lock) {
status = ocfs2_meta_lock(inode, NULL, NULL, 0); status = ocfs2_meta_lock(inode, NULL, 0);
if (status) { if (status) {
make_bad_inode(inode); make_bad_inode(inode);
mlog_errno(status); mlog_errno(status);
...@@ -512,7 +511,7 @@ static int ocfs2_truncate_for_delete(struct ocfs2_super *osb, ...@@ -512,7 +511,7 @@ static int ocfs2_truncate_for_delete(struct ocfs2_super *osb,
struct buffer_head *fe_bh) struct buffer_head *fe_bh)
{ {
int status = 0; int status = 0;
struct ocfs2_journal_handle *handle = NULL; handle_t *handle = NULL;
struct ocfs2_truncate_context *tc = NULL; struct ocfs2_truncate_context *tc = NULL;
struct ocfs2_dinode *fe; struct ocfs2_dinode *fe;
...@@ -524,7 +523,7 @@ static int ocfs2_truncate_for_delete(struct ocfs2_super *osb, ...@@ -524,7 +523,7 @@ static int ocfs2_truncate_for_delete(struct ocfs2_super *osb,
if (!fe->i_clusters) if (!fe->i_clusters)
goto bail; goto bail;
handle = ocfs2_start_trans(osb, handle, OCFS2_INODE_UPDATE_CREDITS); handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS);
if (IS_ERR(handle)) { if (IS_ERR(handle)) {
status = PTR_ERR(handle); status = PTR_ERR(handle);
handle = NULL; handle = NULL;
...@@ -538,7 +537,7 @@ static int ocfs2_truncate_for_delete(struct ocfs2_super *osb, ...@@ -538,7 +537,7 @@ static int ocfs2_truncate_for_delete(struct ocfs2_super *osb,
goto bail; goto bail;
} }
ocfs2_commit_trans(handle); ocfs2_commit_trans(osb, handle);
handle = NULL; handle = NULL;
status = ocfs2_prepare_truncate(osb, inode, fe_bh, &tc); status = ocfs2_prepare_truncate(osb, inode, fe_bh, &tc);
...@@ -554,7 +553,7 @@ static int ocfs2_truncate_for_delete(struct ocfs2_super *osb, ...@@ -554,7 +553,7 @@ static int ocfs2_truncate_for_delete(struct ocfs2_super *osb,
} }
bail: bail:
if (handle) if (handle)
ocfs2_commit_trans(handle); ocfs2_commit_trans(osb, handle);
mlog_exit(status); mlog_exit(status);
return status; return status;
...@@ -568,7 +567,7 @@ static int ocfs2_remove_inode(struct inode *inode, ...@@ -568,7 +567,7 @@ static int ocfs2_remove_inode(struct inode *inode,
int status; int status;
struct inode *inode_alloc_inode = NULL; struct inode *inode_alloc_inode = NULL;
struct buffer_head *inode_alloc_bh = NULL; struct buffer_head *inode_alloc_bh = NULL;
struct ocfs2_journal_handle *handle; handle_t *handle;
struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
struct ocfs2_dinode *di = (struct ocfs2_dinode *) di_bh->b_data; struct ocfs2_dinode *di = (struct ocfs2_dinode *) di_bh->b_data;
...@@ -582,7 +581,7 @@ static int ocfs2_remove_inode(struct inode *inode, ...@@ -582,7 +581,7 @@ static int ocfs2_remove_inode(struct inode *inode,
} }
mutex_lock(&inode_alloc_inode->i_mutex); mutex_lock(&inode_alloc_inode->i_mutex);
status = ocfs2_meta_lock(inode_alloc_inode, NULL, &inode_alloc_bh, 1); status = ocfs2_meta_lock(inode_alloc_inode, &inode_alloc_bh, 1);
if (status < 0) { if (status < 0) {
mutex_unlock(&inode_alloc_inode->i_mutex); mutex_unlock(&inode_alloc_inode->i_mutex);
...@@ -590,7 +589,7 @@ static int ocfs2_remove_inode(struct inode *inode, ...@@ -590,7 +589,7 @@ static int ocfs2_remove_inode(struct inode *inode,
goto bail; goto bail;
} }
handle = ocfs2_start_trans(osb, NULL, OCFS2_DELETE_INODE_CREDITS); handle = ocfs2_start_trans(osb, OCFS2_DELETE_INODE_CREDITS);
if (IS_ERR(handle)) { if (IS_ERR(handle)) {
status = PTR_ERR(handle); status = PTR_ERR(handle);
mlog_errno(status); mlog_errno(status);
...@@ -629,7 +628,7 @@ static int ocfs2_remove_inode(struct inode *inode, ...@@ -629,7 +628,7 @@ static int ocfs2_remove_inode(struct inode *inode,
mlog_errno(status); mlog_errno(status);
bail_commit: bail_commit:
ocfs2_commit_trans(handle); ocfs2_commit_trans(osb, handle);
bail_unlock: bail_unlock:
ocfs2_meta_unlock(inode_alloc_inode, 1); ocfs2_meta_unlock(inode_alloc_inode, 1);
mutex_unlock(&inode_alloc_inode->i_mutex); mutex_unlock(&inode_alloc_inode->i_mutex);
...@@ -705,7 +704,7 @@ static int ocfs2_wipe_inode(struct inode *inode, ...@@ -705,7 +704,7 @@ static int ocfs2_wipe_inode(struct inode *inode,
* delete_inode operation. We do this now to avoid races with * delete_inode operation. We do this now to avoid races with
* recovery completion on other nodes. */ * recovery completion on other nodes. */
mutex_lock(&orphan_dir_inode->i_mutex); mutex_lock(&orphan_dir_inode->i_mutex);
status = ocfs2_meta_lock(orphan_dir_inode, NULL, &orphan_dir_bh, 1); status = ocfs2_meta_lock(orphan_dir_inode, &orphan_dir_bh, 1);
if (status < 0) { if (status < 0) {
mutex_unlock(&orphan_dir_inode->i_mutex); mutex_unlock(&orphan_dir_inode->i_mutex);
...@@ -933,7 +932,7 @@ void ocfs2_delete_inode(struct inode *inode) ...@@ -933,7 +932,7 @@ void ocfs2_delete_inode(struct inode *inode)
* allocation lock here as it won't be needed - nobody will * allocation lock here as it won't be needed - nobody will
* have the file open. * have the file open.
*/ */
status = ocfs2_meta_lock(inode, NULL, &di_bh, 1); status = ocfs2_meta_lock(inode, &di_bh, 1);
if (status < 0) { if (status < 0) {
if (status != -ENOENT) if (status != -ENOENT)
mlog_errno(status); mlog_errno(status);
...@@ -1067,12 +1066,6 @@ void ocfs2_clear_inode(struct inode *inode) ...@@ -1067,12 +1066,6 @@ void ocfs2_clear_inode(struct inode *inode)
mlog_bug_on_msg(oi->ip_open_count, mlog_bug_on_msg(oi->ip_open_count,
"Clear inode of %llu has open count %d\n", "Clear inode of %llu has open count %d\n",
(unsigned long long)oi->ip_blkno, oi->ip_open_count); (unsigned long long)oi->ip_blkno, oi->ip_open_count);
mlog_bug_on_msg(!list_empty(&oi->ip_handle_list),
"Clear inode of %llu has non empty handle list\n",
(unsigned long long)oi->ip_blkno);
mlog_bug_on_msg(oi->ip_handle,
"Clear inode of %llu has non empty handle pointer\n",
(unsigned long long)oi->ip_blkno);
/* Clear all other flags. */ /* Clear all other flags. */
oi->ip_flags = OCFS2_INODE_CACHE_INLINE; oi->ip_flags = OCFS2_INODE_CACHE_INLINE;
...@@ -1186,7 +1179,7 @@ int ocfs2_inode_revalidate(struct dentry *dentry) ...@@ -1186,7 +1179,7 @@ int ocfs2_inode_revalidate(struct dentry *dentry)
/* Let ocfs2_meta_lock do the work of updating our struct /* Let ocfs2_meta_lock do the work of updating our struct
* inode for us. */ * inode for us. */
status = ocfs2_meta_lock(inode, NULL, NULL, 0); status = ocfs2_meta_lock(inode, NULL, 0);
if (status < 0) { if (status < 0) {
if (status != -ENOENT) if (status != -ENOENT)
mlog_errno(status); mlog_errno(status);
...@@ -1204,7 +1197,7 @@ int ocfs2_inode_revalidate(struct dentry *dentry) ...@@ -1204,7 +1197,7 @@ int ocfs2_inode_revalidate(struct dentry *dentry)
* struct inode. * struct inode.
* Only takes ip_lock. * Only takes ip_lock.
*/ */
int ocfs2_mark_inode_dirty(struct ocfs2_journal_handle *handle, int ocfs2_mark_inode_dirty(handle_t *handle,
struct inode *inode, struct inode *inode,
struct buffer_head *bh) struct buffer_head *bh)
{ {
......
...@@ -48,13 +48,6 @@ struct ocfs2_inode_info ...@@ -48,13 +48,6 @@ struct ocfs2_inode_info
struct mutex ip_io_mutex; struct mutex ip_io_mutex;
/* Used by the journalling code to attach an inode to a
* handle. These are protected by ip_io_mutex in order to lock
* out other I/O to the inode until we either commit or
* abort. */
struct list_head ip_handle_list;
struct ocfs2_journal_handle *ip_handle;
u32 ip_flags; /* see below */ u32 ip_flags; /* see below */
u32 ip_attr; /* inode attributes */ u32 ip_attr; /* inode attributes */
...@@ -143,7 +136,7 @@ ssize_t ocfs2_rw_direct(int rw, struct file *filp, char *buf, ...@@ -143,7 +136,7 @@ ssize_t ocfs2_rw_direct(int rw, struct file *filp, char *buf,
void ocfs2_sync_blockdev(struct super_block *sb); void ocfs2_sync_blockdev(struct super_block *sb);
void ocfs2_refresh_inode(struct inode *inode, void ocfs2_refresh_inode(struct inode *inode,
struct ocfs2_dinode *fe); struct ocfs2_dinode *fe);
int ocfs2_mark_inode_dirty(struct ocfs2_journal_handle *handle, int ocfs2_mark_inode_dirty(handle_t *handle,
struct inode *inode, struct inode *inode,
struct buffer_head *bh); struct buffer_head *bh);
int ocfs2_aio_read(struct file *file, struct kiocb *req, struct iocb *iocb); int ocfs2_aio_read(struct file *file, struct kiocb *req, struct iocb *iocb);
......
...@@ -26,7 +26,7 @@ static int ocfs2_get_inode_attr(struct inode *inode, unsigned *flags) ...@@ -26,7 +26,7 @@ static int ocfs2_get_inode_attr(struct inode *inode, unsigned *flags)
{ {
int status; int status;
status = ocfs2_meta_lock(inode, NULL, NULL, 0); status = ocfs2_meta_lock(inode, NULL, 0);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
return status; return status;
...@@ -43,14 +43,14 @@ static int ocfs2_set_inode_attr(struct inode *inode, unsigned flags, ...@@ -43,14 +43,14 @@ static int ocfs2_set_inode_attr(struct inode *inode, unsigned flags,
{ {
struct ocfs2_inode_info *ocfs2_inode = OCFS2_I(inode); struct ocfs2_inode_info *ocfs2_inode = OCFS2_I(inode);
struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
struct ocfs2_journal_handle *handle = NULL; handle_t *handle = NULL;
struct buffer_head *bh = NULL; struct buffer_head *bh = NULL;
unsigned oldflags; unsigned oldflags;
int status; int status;
mutex_lock(&inode->i_mutex); mutex_lock(&inode->i_mutex);
status = ocfs2_meta_lock(inode, NULL, &bh, 1); status = ocfs2_meta_lock(inode, &bh, 1);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
goto bail; goto bail;
...@@ -67,7 +67,7 @@ static int ocfs2_set_inode_attr(struct inode *inode, unsigned flags, ...@@ -67,7 +67,7 @@ static int ocfs2_set_inode_attr(struct inode *inode, unsigned flags,
if (!S_ISDIR(inode->i_mode)) if (!S_ISDIR(inode->i_mode))
flags &= ~OCFS2_DIRSYNC_FL; flags &= ~OCFS2_DIRSYNC_FL;
handle = ocfs2_start_trans(osb, NULL, OCFS2_INODE_UPDATE_CREDITS); handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS);
if (IS_ERR(handle)) { if (IS_ERR(handle)) {
status = PTR_ERR(handle); status = PTR_ERR(handle);
mlog_errno(status); mlog_errno(status);
...@@ -96,7 +96,7 @@ static int ocfs2_set_inode_attr(struct inode *inode, unsigned flags, ...@@ -96,7 +96,7 @@ static int ocfs2_set_inode_attr(struct inode *inode, unsigned flags,
if (status < 0) if (status < 0)
mlog_errno(status); mlog_errno(status);
ocfs2_commit_trans(handle); ocfs2_commit_trans(osb, handle);
bail_unlock: bail_unlock:
ocfs2_meta_unlock(inode, 1); ocfs2_meta_unlock(inode, 1);
bail: bail:
......
This diff is collapsed.
...@@ -37,7 +37,6 @@ enum ocfs2_journal_state { ...@@ -37,7 +37,6 @@ enum ocfs2_journal_state {
struct ocfs2_super; struct ocfs2_super;
struct ocfs2_dinode; struct ocfs2_dinode;
struct ocfs2_journal_handle;
struct ocfs2_journal { struct ocfs2_journal {
enum ocfs2_journal_state j_state; /* Journals current state */ enum ocfs2_journal_state j_state; /* Journals current state */
...@@ -133,44 +132,6 @@ static inline void ocfs2_inode_set_new(struct ocfs2_super *osb, ...@@ -133,44 +132,6 @@ static inline void ocfs2_inode_set_new(struct ocfs2_super *osb,
spin_unlock(&trans_inc_lock); spin_unlock(&trans_inc_lock);
} }
extern kmem_cache_t *ocfs2_lock_cache;
struct ocfs2_journal_lock {
struct inode *jl_inode;
struct list_head jl_lock_list;
};
struct ocfs2_journal_handle {
handle_t *k_handle; /* kernel handle. */
struct ocfs2_journal *journal;
u32 flags; /* see flags below. */
int max_buffs; /* Buffs reserved by this handle */
/* The following two fields are for ocfs2_handle_add_lock */
int num_locks;
struct list_head locks; /* A bunch of locks to
* release on commit. This
* should be a list_head */
struct list_head inode_list;
};
#define OCFS2_HANDLE_STARTED 1
/* should we sync-commit this handle? */
#define OCFS2_HANDLE_SYNC 2
static inline int ocfs2_handle_started(struct ocfs2_journal_handle *handle)
{
return handle->flags & OCFS2_HANDLE_STARTED;
}
static inline void ocfs2_handle_set_sync(struct ocfs2_journal_handle *handle, int sync)
{
if (sync)
handle->flags |= OCFS2_HANDLE_SYNC;
else
handle->flags &= ~OCFS2_HANDLE_SYNC;
}
/* Exported only for the journal struct init code in super.c. Do not call. */ /* Exported only for the journal struct init code in super.c. Do not call. */
void ocfs2_complete_recovery(void *data); void ocfs2_complete_recovery(void *data);
...@@ -231,15 +192,14 @@ static inline void ocfs2_checkpoint_inode(struct inode *inode) ...@@ -231,15 +192,14 @@ static inline void ocfs2_checkpoint_inode(struct inode *inode)
* Transaction Handling: * Transaction Handling:
* Manage the lifetime of a transaction handle. * Manage the lifetime of a transaction handle.
* *
* ocfs2_alloc_handle - Only allocate a handle so we can start putting
* cluster locks on it. To actually change blocks,
* call ocfs2_start_trans with the handle returned
* from this function. You may call ocfs2_commit_trans
* at any time in the lifetime of a handle.
* ocfs2_start_trans - Begin a transaction. Give it an upper estimate of * ocfs2_start_trans - Begin a transaction. Give it an upper estimate of
* the number of blocks that will be changed during * the number of blocks that will be changed during
* this handle. * this handle.
* ocfs2_commit_trans - Complete a handle. * ocfs2_commit_trans - Complete a handle. It might return -EIO if
* the journal was aborted. The majority of paths don't
* check the return value as an error there comes too
* late to do anything (and will be picked up in a
* later transaction).
* ocfs2_extend_trans - Extend a handle by nblocks credits. This may * ocfs2_extend_trans - Extend a handle by nblocks credits. This may
* commit the handle to disk in the process, but will * commit the handle to disk in the process, but will
* not release any locks taken during the transaction. * not release any locks taken during the transaction.
...@@ -249,24 +209,16 @@ static inline void ocfs2_checkpoint_inode(struct inode *inode) ...@@ -249,24 +209,16 @@ static inline void ocfs2_checkpoint_inode(struct inode *inode)
* ocfs2_journal_dirty - Mark a journalled buffer as having dirty data. * ocfs2_journal_dirty - Mark a journalled buffer as having dirty data.
* ocfs2_journal_dirty_data - Indicate that a data buffer should go out before * ocfs2_journal_dirty_data - Indicate that a data buffer should go out before
* the current handle commits. * the current handle commits.
* ocfs2_handle_add_lock - Sometimes we need to delay lock release
* until after a transaction has been completed. Use
* ocfs2_handle_add_lock to indicate that a lock needs
* to be released at the end of that handle. Locks
* will be released in the order that they are added.
* ocfs2_handle_add_inode - Add a locked inode to a transaction.
*/ */
/* You must always start_trans with a number of buffs > 0, but it's /* You must always start_trans with a number of buffs > 0, but it's
* perfectly legal to go through an entire transaction without having * perfectly legal to go through an entire transaction without having
* dirtied any buffers. */ * dirtied any buffers. */
struct ocfs2_journal_handle *ocfs2_alloc_handle(struct ocfs2_super *osb); handle_t *ocfs2_start_trans(struct ocfs2_super *osb,
struct ocfs2_journal_handle *ocfs2_start_trans(struct ocfs2_super *osb,
struct ocfs2_journal_handle *handle,
int max_buffs); int max_buffs);
void ocfs2_commit_trans(struct ocfs2_journal_handle *handle); int ocfs2_commit_trans(struct ocfs2_super *osb,
int ocfs2_extend_trans(struct ocfs2_journal_handle *handle, handle_t *handle);
int nblocks); int ocfs2_extend_trans(handle_t *handle, int nblocks);
/* /*
* Create access is for when we get a newly created buffer and we're * Create access is for when we get a newly created buffer and we're
...@@ -283,7 +235,7 @@ int ocfs2_extend_trans(struct ocfs2_journal_handle *handle, ...@@ -283,7 +235,7 @@ int ocfs2_extend_trans(struct ocfs2_journal_handle *handle,
#define OCFS2_JOURNAL_ACCESS_WRITE 1 #define OCFS2_JOURNAL_ACCESS_WRITE 1
#define OCFS2_JOURNAL_ACCESS_UNDO 2 #define OCFS2_JOURNAL_ACCESS_UNDO 2
int ocfs2_journal_access(struct ocfs2_journal_handle *handle, int ocfs2_journal_access(handle_t *handle,
struct inode *inode, struct inode *inode,
struct buffer_head *bh, struct buffer_head *bh,
int type); int type);
...@@ -306,18 +258,10 @@ int ocfs2_journal_access(struct ocfs2_journal_handle *handle, ...@@ -306,18 +258,10 @@ int ocfs2_journal_access(struct ocfs2_journal_handle *handle,
* <modify the bh> * <modify the bh>
* ocfs2_journal_dirty(handle, bh); * ocfs2_journal_dirty(handle, bh);
*/ */
int ocfs2_journal_dirty(struct ocfs2_journal_handle *handle, int ocfs2_journal_dirty(handle_t *handle,
struct buffer_head *bh); struct buffer_head *bh);
int ocfs2_journal_dirty_data(handle_t *handle, int ocfs2_journal_dirty_data(handle_t *handle,
struct buffer_head *bh); struct buffer_head *bh);
int ocfs2_handle_add_lock(struct ocfs2_journal_handle *handle,
struct inode *inode);
/*
* Use this to protect from other processes reading buffer state while
* it's in flight.
*/
void ocfs2_handle_add_inode(struct ocfs2_journal_handle *handle,
struct inode *inode);
/* /*
* Credit Macros: * Credit Macros:
......
...@@ -58,19 +58,18 @@ static int ocfs2_local_alloc_find_clear_bits(struct ocfs2_super *osb, ...@@ -58,19 +58,18 @@ static int ocfs2_local_alloc_find_clear_bits(struct ocfs2_super *osb,
static void ocfs2_clear_local_alloc(struct ocfs2_dinode *alloc); static void ocfs2_clear_local_alloc(struct ocfs2_dinode *alloc);
static int ocfs2_sync_local_to_main(struct ocfs2_super *osb, static int ocfs2_sync_local_to_main(struct ocfs2_super *osb,
struct ocfs2_journal_handle *handle, handle_t *handle,
struct ocfs2_dinode *alloc, struct ocfs2_dinode *alloc,
struct inode *main_bm_inode, struct inode *main_bm_inode,
struct buffer_head *main_bm_bh); struct buffer_head *main_bm_bh);
static int ocfs2_local_alloc_reserve_for_window(struct ocfs2_super *osb, static int ocfs2_local_alloc_reserve_for_window(struct ocfs2_super *osb,
struct ocfs2_journal_handle *handle,
struct ocfs2_alloc_context **ac, struct ocfs2_alloc_context **ac,
struct inode **bitmap_inode, struct inode **bitmap_inode,
struct buffer_head **bitmap_bh); struct buffer_head **bitmap_bh);
static int ocfs2_local_alloc_new_window(struct ocfs2_super *osb, static int ocfs2_local_alloc_new_window(struct ocfs2_super *osb,
struct ocfs2_journal_handle *handle, handle_t *handle,
struct ocfs2_alloc_context *ac); struct ocfs2_alloc_context *ac);
static int ocfs2_local_alloc_slide_window(struct ocfs2_super *osb, static int ocfs2_local_alloc_slide_window(struct ocfs2_super *osb,
...@@ -196,7 +195,7 @@ int ocfs2_load_local_alloc(struct ocfs2_super *osb) ...@@ -196,7 +195,7 @@ int ocfs2_load_local_alloc(struct ocfs2_super *osb)
void ocfs2_shutdown_local_alloc(struct ocfs2_super *osb) void ocfs2_shutdown_local_alloc(struct ocfs2_super *osb)
{ {
int status; int status;
struct ocfs2_journal_handle *handle = NULL; handle_t *handle;
struct inode *local_alloc_inode = NULL; struct inode *local_alloc_inode = NULL;
struct buffer_head *bh = NULL; struct buffer_head *bh = NULL;
struct buffer_head *main_bm_bh = NULL; struct buffer_head *main_bm_bh = NULL;
...@@ -207,7 +206,7 @@ void ocfs2_shutdown_local_alloc(struct ocfs2_super *osb) ...@@ -207,7 +206,7 @@ void ocfs2_shutdown_local_alloc(struct ocfs2_super *osb)
mlog_entry_void(); mlog_entry_void();
if (osb->local_alloc_state == OCFS2_LA_UNUSED) if (osb->local_alloc_state == OCFS2_LA_UNUSED)
goto bail; goto out;
local_alloc_inode = local_alloc_inode =
ocfs2_get_system_file_inode(osb, ocfs2_get_system_file_inode(osb,
...@@ -216,40 +215,34 @@ void ocfs2_shutdown_local_alloc(struct ocfs2_super *osb) ...@@ -216,40 +215,34 @@ void ocfs2_shutdown_local_alloc(struct ocfs2_super *osb)
if (!local_alloc_inode) { if (!local_alloc_inode) {
status = -ENOENT; status = -ENOENT;
mlog_errno(status); mlog_errno(status);
goto bail; goto out;
} }
osb->local_alloc_state = OCFS2_LA_DISABLED; osb->local_alloc_state = OCFS2_LA_DISABLED;
handle = ocfs2_alloc_handle(osb);
if (!handle) {
status = -ENOMEM;
mlog_errno(status);
goto bail;
}
main_bm_inode = ocfs2_get_system_file_inode(osb, main_bm_inode = ocfs2_get_system_file_inode(osb,
GLOBAL_BITMAP_SYSTEM_INODE, GLOBAL_BITMAP_SYSTEM_INODE,
OCFS2_INVALID_SLOT); OCFS2_INVALID_SLOT);
if (!main_bm_inode) { if (!main_bm_inode) {
status = -EINVAL; status = -EINVAL;
mlog_errno(status); mlog_errno(status);
goto bail; goto out;
} }
ocfs2_handle_add_inode(handle, main_bm_inode); mutex_lock(&main_bm_inode->i_mutex);
status = ocfs2_meta_lock(main_bm_inode, handle, &main_bm_bh, 1);
status = ocfs2_meta_lock(main_bm_inode, &main_bm_bh, 1);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
goto bail; goto out_mutex;
} }
/* WINDOW_MOVE_CREDITS is a bit heavy... */ /* WINDOW_MOVE_CREDITS is a bit heavy... */
handle = ocfs2_start_trans(osb, handle, OCFS2_WINDOW_MOVE_CREDITS); handle = ocfs2_start_trans(osb, OCFS2_WINDOW_MOVE_CREDITS);
if (IS_ERR(handle)) { if (IS_ERR(handle)) {
mlog_errno(PTR_ERR(handle)); mlog_errno(PTR_ERR(handle));
handle = NULL; handle = NULL;
goto bail; goto out_unlock;
} }
bh = osb->local_alloc_bh; bh = osb->local_alloc_bh;
...@@ -258,7 +251,7 @@ void ocfs2_shutdown_local_alloc(struct ocfs2_super *osb) ...@@ -258,7 +251,7 @@ void ocfs2_shutdown_local_alloc(struct ocfs2_super *osb)
alloc_copy = kmalloc(bh->b_size, GFP_KERNEL); alloc_copy = kmalloc(bh->b_size, GFP_KERNEL);
if (!alloc_copy) { if (!alloc_copy) {
status = -ENOMEM; status = -ENOMEM;
goto bail; goto out_commit;
} }
memcpy(alloc_copy, alloc, bh->b_size); memcpy(alloc_copy, alloc, bh->b_size);
...@@ -266,7 +259,7 @@ void ocfs2_shutdown_local_alloc(struct ocfs2_super *osb) ...@@ -266,7 +259,7 @@ void ocfs2_shutdown_local_alloc(struct ocfs2_super *osb)
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
goto bail; goto out_commit;
} }
ocfs2_clear_local_alloc(alloc); ocfs2_clear_local_alloc(alloc);
...@@ -274,7 +267,7 @@ void ocfs2_shutdown_local_alloc(struct ocfs2_super *osb) ...@@ -274,7 +267,7 @@ void ocfs2_shutdown_local_alloc(struct ocfs2_super *osb)
status = ocfs2_journal_dirty(handle, bh); status = ocfs2_journal_dirty(handle, bh);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
goto bail; goto out_commit;
} }
brelse(bh); brelse(bh);
...@@ -286,16 +279,20 @@ void ocfs2_shutdown_local_alloc(struct ocfs2_super *osb) ...@@ -286,16 +279,20 @@ void ocfs2_shutdown_local_alloc(struct ocfs2_super *osb)
if (status < 0) if (status < 0)
mlog_errno(status); mlog_errno(status);
bail: out_commit:
if (handle) ocfs2_commit_trans(osb, handle);
ocfs2_commit_trans(handle);
out_unlock:
if (main_bm_bh) if (main_bm_bh)
brelse(main_bm_bh); brelse(main_bm_bh);
if (main_bm_inode) ocfs2_meta_unlock(main_bm_inode, 1);
out_mutex:
mutex_unlock(&main_bm_inode->i_mutex);
iput(main_bm_inode); iput(main_bm_inode);
out:
if (local_alloc_inode) if (local_alloc_inode)
iput(local_alloc_inode); iput(local_alloc_inode);
...@@ -385,61 +382,59 @@ int ocfs2_complete_local_alloc_recovery(struct ocfs2_super *osb, ...@@ -385,61 +382,59 @@ int ocfs2_complete_local_alloc_recovery(struct ocfs2_super *osb,
struct ocfs2_dinode *alloc) struct ocfs2_dinode *alloc)
{ {
int status; int status;
struct ocfs2_journal_handle *handle = NULL; handle_t *handle;
struct buffer_head *main_bm_bh = NULL; struct buffer_head *main_bm_bh = NULL;
struct inode *main_bm_inode = NULL; struct inode *main_bm_inode;
mlog_entry_void(); mlog_entry_void();
handle = ocfs2_alloc_handle(osb);
if (!handle) {
status = -ENOMEM;
mlog_errno(status);
goto bail;
}
main_bm_inode = ocfs2_get_system_file_inode(osb, main_bm_inode = ocfs2_get_system_file_inode(osb,
GLOBAL_BITMAP_SYSTEM_INODE, GLOBAL_BITMAP_SYSTEM_INODE,
OCFS2_INVALID_SLOT); OCFS2_INVALID_SLOT);
if (!main_bm_inode) { if (!main_bm_inode) {
status = -EINVAL; status = -EINVAL;
mlog_errno(status); mlog_errno(status);
goto bail; goto out;
} }
ocfs2_handle_add_inode(handle, main_bm_inode); mutex_lock(&main_bm_inode->i_mutex);
status = ocfs2_meta_lock(main_bm_inode, handle, &main_bm_bh, 1);
status = ocfs2_meta_lock(main_bm_inode, &main_bm_bh, 1);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
goto bail; goto out_mutex;
} }
handle = ocfs2_start_trans(osb, handle, OCFS2_WINDOW_MOVE_CREDITS); handle = ocfs2_start_trans(osb, OCFS2_WINDOW_MOVE_CREDITS);
if (IS_ERR(handle)) { if (IS_ERR(handle)) {
status = PTR_ERR(handle); status = PTR_ERR(handle);
handle = NULL; handle = NULL;
mlog_errno(status); mlog_errno(status);
goto bail; goto out_unlock;
} }
/* we want the bitmap change to be recorded on disk asap */ /* we want the bitmap change to be recorded on disk asap */
ocfs2_handle_set_sync(handle, 1); handle->h_sync = 1;
status = ocfs2_sync_local_to_main(osb, handle, alloc, status = ocfs2_sync_local_to_main(osb, handle, alloc,
main_bm_inode, main_bm_bh); main_bm_inode, main_bm_bh);
if (status < 0) if (status < 0)
mlog_errno(status); mlog_errno(status);
bail: ocfs2_commit_trans(osb, handle);
if (handle)
ocfs2_commit_trans(handle); out_unlock:
ocfs2_meta_unlock(main_bm_inode, 1);
out_mutex:
mutex_unlock(&main_bm_inode->i_mutex);
if (main_bm_bh) if (main_bm_bh)
brelse(main_bm_bh); brelse(main_bm_bh);
if (main_bm_inode)
iput(main_bm_inode); iput(main_bm_inode);
out:
mlog_exit(status); mlog_exit(status);
return status; return status;
} }
...@@ -452,7 +447,6 @@ int ocfs2_complete_local_alloc_recovery(struct ocfs2_super *osb, ...@@ -452,7 +447,6 @@ int ocfs2_complete_local_alloc_recovery(struct ocfs2_super *osb,
* our own in order to shift windows. * our own in order to shift windows.
*/ */
int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb, int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb,
struct ocfs2_journal_handle *passed_handle,
u32 bits_wanted, u32 bits_wanted,
struct ocfs2_alloc_context *ac) struct ocfs2_alloc_context *ac)
{ {
...@@ -463,9 +457,7 @@ int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb, ...@@ -463,9 +457,7 @@ int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb,
mlog_entry_void(); mlog_entry_void();
BUG_ON(!passed_handle);
BUG_ON(!ac); BUG_ON(!ac);
BUG_ON(passed_handle->flags & OCFS2_HANDLE_STARTED);
local_alloc_inode = local_alloc_inode =
ocfs2_get_system_file_inode(osb, ocfs2_get_system_file_inode(osb,
...@@ -476,7 +468,11 @@ int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb, ...@@ -476,7 +468,11 @@ int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb,
mlog_errno(status); mlog_errno(status);
goto bail; goto bail;
} }
ocfs2_handle_add_inode(passed_handle, local_alloc_inode);
mutex_lock(&local_alloc_inode->i_mutex);
ac->ac_inode = local_alloc_inode;
ac->ac_which = OCFS2_AC_USE_LOCAL;
if (osb->local_alloc_state != OCFS2_LA_ENABLED) { if (osb->local_alloc_state != OCFS2_LA_ENABLED) {
status = -ENOSPC; status = -ENOSPC;
...@@ -515,21 +511,17 @@ int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb, ...@@ -515,21 +511,17 @@ int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb,
} }
} }
ac->ac_inode = igrab(local_alloc_inode);
get_bh(osb->local_alloc_bh); get_bh(osb->local_alloc_bh);
ac->ac_bh = osb->local_alloc_bh; ac->ac_bh = osb->local_alloc_bh;
ac->ac_which = OCFS2_AC_USE_LOCAL;
status = 0; status = 0;
bail: bail:
if (local_alloc_inode)
iput(local_alloc_inode);
mlog_exit(status); mlog_exit(status);
return status; return status;
} }
int ocfs2_claim_local_alloc_bits(struct ocfs2_super *osb, int ocfs2_claim_local_alloc_bits(struct ocfs2_super *osb,
struct ocfs2_journal_handle *handle, handle_t *handle,
struct ocfs2_alloc_context *ac, struct ocfs2_alloc_context *ac,
u32 min_bits, u32 min_bits,
u32 *bit_off, u32 *bit_off,
...@@ -707,7 +699,7 @@ static void ocfs2_verify_zero_bits(unsigned long *bitmap, ...@@ -707,7 +699,7 @@ static void ocfs2_verify_zero_bits(unsigned long *bitmap,
* passed is used for caching. * passed is used for caching.
*/ */
static int ocfs2_sync_local_to_main(struct ocfs2_super *osb, static int ocfs2_sync_local_to_main(struct ocfs2_super *osb,
struct ocfs2_journal_handle *handle, handle_t *handle,
struct ocfs2_dinode *alloc, struct ocfs2_dinode *alloc,
struct inode *main_bm_inode, struct inode *main_bm_inode,
struct buffer_head *main_bm_bh) struct buffer_head *main_bm_bh)
...@@ -778,7 +770,6 @@ static int ocfs2_sync_local_to_main(struct ocfs2_super *osb, ...@@ -778,7 +770,6 @@ static int ocfs2_sync_local_to_main(struct ocfs2_super *osb,
} }
static int ocfs2_local_alloc_reserve_for_window(struct ocfs2_super *osb, static int ocfs2_local_alloc_reserve_for_window(struct ocfs2_super *osb,
struct ocfs2_journal_handle *handle,
struct ocfs2_alloc_context **ac, struct ocfs2_alloc_context **ac,
struct inode **bitmap_inode, struct inode **bitmap_inode,
struct buffer_head **bitmap_bh) struct buffer_head **bitmap_bh)
...@@ -792,7 +783,6 @@ static int ocfs2_local_alloc_reserve_for_window(struct ocfs2_super *osb, ...@@ -792,7 +783,6 @@ static int ocfs2_local_alloc_reserve_for_window(struct ocfs2_super *osb,
goto bail; goto bail;
} }
(*ac)->ac_handle = handle;
(*ac)->ac_bits_wanted = ocfs2_local_alloc_window_bits(osb); (*ac)->ac_bits_wanted = ocfs2_local_alloc_window_bits(osb);
status = ocfs2_reserve_cluster_bitmap_bits(osb, *ac); status = ocfs2_reserve_cluster_bitmap_bits(osb, *ac);
...@@ -821,7 +811,7 @@ static int ocfs2_local_alloc_reserve_for_window(struct ocfs2_super *osb, ...@@ -821,7 +811,7 @@ static int ocfs2_local_alloc_reserve_for_window(struct ocfs2_super *osb,
* pass it the bitmap lock in lock_bh if you have it. * pass it the bitmap lock in lock_bh if you have it.
*/ */
static int ocfs2_local_alloc_new_window(struct ocfs2_super *osb, static int ocfs2_local_alloc_new_window(struct ocfs2_super *osb,
struct ocfs2_journal_handle *handle, handle_t *handle,
struct ocfs2_alloc_context *ac) struct ocfs2_alloc_context *ac)
{ {
int status = 0; int status = 0;
...@@ -888,23 +878,15 @@ static int ocfs2_local_alloc_slide_window(struct ocfs2_super *osb, ...@@ -888,23 +878,15 @@ static int ocfs2_local_alloc_slide_window(struct ocfs2_super *osb,
int status = 0; int status = 0;
struct buffer_head *main_bm_bh = NULL; struct buffer_head *main_bm_bh = NULL;
struct inode *main_bm_inode = NULL; struct inode *main_bm_inode = NULL;
struct ocfs2_journal_handle *handle = NULL; handle_t *handle = NULL;
struct ocfs2_dinode *alloc; struct ocfs2_dinode *alloc;
struct ocfs2_dinode *alloc_copy = NULL; struct ocfs2_dinode *alloc_copy = NULL;
struct ocfs2_alloc_context *ac = NULL; struct ocfs2_alloc_context *ac = NULL;
mlog_entry_void(); mlog_entry_void();
handle = ocfs2_alloc_handle(osb);
if (!handle) {
status = -ENOMEM;
mlog_errno(status);
goto bail;
}
/* This will lock the main bitmap for us. */ /* This will lock the main bitmap for us. */
status = ocfs2_local_alloc_reserve_for_window(osb, status = ocfs2_local_alloc_reserve_for_window(osb,
handle,
&ac, &ac,
&main_bm_inode, &main_bm_inode,
&main_bm_bh); &main_bm_bh);
...@@ -914,7 +896,7 @@ static int ocfs2_local_alloc_slide_window(struct ocfs2_super *osb, ...@@ -914,7 +896,7 @@ static int ocfs2_local_alloc_slide_window(struct ocfs2_super *osb,
goto bail; goto bail;
} }
handle = ocfs2_start_trans(osb, handle, OCFS2_WINDOW_MOVE_CREDITS); handle = ocfs2_start_trans(osb, OCFS2_WINDOW_MOVE_CREDITS);
if (IS_ERR(handle)) { if (IS_ERR(handle)) {
status = PTR_ERR(handle); status = PTR_ERR(handle);
handle = NULL; handle = NULL;
...@@ -972,7 +954,7 @@ static int ocfs2_local_alloc_slide_window(struct ocfs2_super *osb, ...@@ -972,7 +954,7 @@ static int ocfs2_local_alloc_slide_window(struct ocfs2_super *osb,
status = 0; status = 0;
bail: bail:
if (handle) if (handle)
ocfs2_commit_trans(handle); ocfs2_commit_trans(osb, handle);
if (main_bm_bh) if (main_bm_bh)
brelse(main_bm_bh); brelse(main_bm_bh);
......
...@@ -42,12 +42,11 @@ int ocfs2_alloc_should_use_local(struct ocfs2_super *osb, ...@@ -42,12 +42,11 @@ int ocfs2_alloc_should_use_local(struct ocfs2_super *osb,
struct ocfs2_alloc_context; struct ocfs2_alloc_context;
int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb, int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb,
struct ocfs2_journal_handle *passed_handle,
u32 bits_wanted, u32 bits_wanted,
struct ocfs2_alloc_context *ac); struct ocfs2_alloc_context *ac);
int ocfs2_claim_local_alloc_bits(struct ocfs2_super *osb, int ocfs2_claim_local_alloc_bits(struct ocfs2_super *osb,
struct ocfs2_journal_handle *handle, handle_t *handle,
struct ocfs2_alloc_context *ac, struct ocfs2_alloc_context *ac,
u32 min_bits, u32 min_bits,
u32 *bit_off, u32 *bit_off,
......
...@@ -82,6 +82,8 @@ static struct vm_operations_struct ocfs2_file_vm_ops = { ...@@ -82,6 +82,8 @@ static struct vm_operations_struct ocfs2_file_vm_ops = {
int ocfs2_mmap(struct file *file, struct vm_area_struct *vma) int ocfs2_mmap(struct file *file, struct vm_area_struct *vma)
{ {
int ret = 0, lock_level = 0;
/* We don't want to support shared writable mappings yet. */ /* We don't want to support shared writable mappings yet. */
if (((vma->vm_flags & VM_SHARED) || (vma->vm_flags & VM_MAYSHARE)) if (((vma->vm_flags & VM_SHARED) || (vma->vm_flags & VM_MAYSHARE))
&& ((vma->vm_flags & VM_WRITE) || (vma->vm_flags & VM_MAYWRITE))) { && ((vma->vm_flags & VM_WRITE) || (vma->vm_flags & VM_MAYWRITE))) {
...@@ -91,7 +93,14 @@ int ocfs2_mmap(struct file *file, struct vm_area_struct *vma) ...@@ -91,7 +93,14 @@ int ocfs2_mmap(struct file *file, struct vm_area_struct *vma)
return -EINVAL; return -EINVAL;
} }
file_accessed(file); ret = ocfs2_meta_lock_atime(file->f_dentry->d_inode,
file->f_vfsmnt, &lock_level);
if (ret < 0) {
mlog_errno(ret);
goto out;
}
ocfs2_meta_unlock(file->f_dentry->d_inode, lock_level);
out:
vma->vm_ops = &ocfs2_file_vm_ops; vma->vm_ops = &ocfs2_file_vm_ops;
return 0; return 0;
} }
......
This diff is collapsed.
...@@ -39,7 +39,7 @@ struct buffer_head *ocfs2_find_entry(const char *name, ...@@ -39,7 +39,7 @@ struct buffer_head *ocfs2_find_entry(const char *name,
struct inode *dir, struct inode *dir,
struct ocfs2_dir_entry **res_dir); struct ocfs2_dir_entry **res_dir);
int ocfs2_orphan_del(struct ocfs2_super *osb, int ocfs2_orphan_del(struct ocfs2_super *osb,
struct ocfs2_journal_handle *handle, handle_t *handle,
struct inode *orphan_dir_inode, struct inode *orphan_dir_inode,
struct inode *inode, struct inode *inode,
struct buffer_head *orphan_dir_bh); struct buffer_head *orphan_dir_bh);
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/kref.h> #include <linux/kref.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/jbd.h>
#include "cluster/nodemanager.h" #include "cluster/nodemanager.h"
#include "cluster/heartbeat.h" #include "cluster/heartbeat.h"
...@@ -179,9 +180,9 @@ enum ocfs2_mount_options ...@@ -179,9 +180,9 @@ enum ocfs2_mount_options
#define OCFS2_OSB_SOFT_RO 0x0001 #define OCFS2_OSB_SOFT_RO 0x0001
#define OCFS2_OSB_HARD_RO 0x0002 #define OCFS2_OSB_HARD_RO 0x0002
#define OCFS2_OSB_ERROR_FS 0x0004 #define OCFS2_OSB_ERROR_FS 0x0004
#define OCFS2_DEFAULT_ATIME_QUANTUM 60
struct ocfs2_journal; struct ocfs2_journal;
struct ocfs2_journal_handle;
struct ocfs2_super struct ocfs2_super
{ {
struct task_struct *commit_task; struct task_struct *commit_task;
...@@ -218,6 +219,7 @@ struct ocfs2_super ...@@ -218,6 +219,7 @@ struct ocfs2_super
unsigned long osb_flags; unsigned long osb_flags;
unsigned long s_mount_opt; unsigned long s_mount_opt;
unsigned int s_atime_quantum;
u16 max_slots; u16 max_slots;
s16 node_num; s16 node_num;
......
This diff is collapsed.
...@@ -43,7 +43,6 @@ struct ocfs2_alloc_context { ...@@ -43,7 +43,6 @@ struct ocfs2_alloc_context {
#define OCFS2_AC_USE_INODE 3 #define OCFS2_AC_USE_INODE 3
#define OCFS2_AC_USE_META 4 #define OCFS2_AC_USE_META 4
u32 ac_which; u32 ac_which;
struct ocfs2_journal_handle *ac_handle;
/* these are used by the chain search */ /* these are used by the chain search */
u16 ac_chain; u16 ac_chain;
...@@ -60,45 +59,42 @@ static inline int ocfs2_alloc_context_bits_left(struct ocfs2_alloc_context *ac) ...@@ -60,45 +59,42 @@ static inline int ocfs2_alloc_context_bits_left(struct ocfs2_alloc_context *ac)
} }
int ocfs2_reserve_new_metadata(struct ocfs2_super *osb, int ocfs2_reserve_new_metadata(struct ocfs2_super *osb,
struct ocfs2_journal_handle *handle,
struct ocfs2_dinode *fe, struct ocfs2_dinode *fe,
struct ocfs2_alloc_context **ac); struct ocfs2_alloc_context **ac);
int ocfs2_reserve_new_inode(struct ocfs2_super *osb, int ocfs2_reserve_new_inode(struct ocfs2_super *osb,
struct ocfs2_journal_handle *handle,
struct ocfs2_alloc_context **ac); struct ocfs2_alloc_context **ac);
int ocfs2_reserve_clusters(struct ocfs2_super *osb, int ocfs2_reserve_clusters(struct ocfs2_super *osb,
struct ocfs2_journal_handle *handle,
u32 bits_wanted, u32 bits_wanted,
struct ocfs2_alloc_context **ac); struct ocfs2_alloc_context **ac);
int ocfs2_claim_metadata(struct ocfs2_super *osb, int ocfs2_claim_metadata(struct ocfs2_super *osb,
struct ocfs2_journal_handle *handle, handle_t *handle,
struct ocfs2_alloc_context *ac, struct ocfs2_alloc_context *ac,
u32 bits_wanted, u32 bits_wanted,
u16 *suballoc_bit_start, u16 *suballoc_bit_start,
u32 *num_bits, u32 *num_bits,
u64 *blkno_start); u64 *blkno_start);
int ocfs2_claim_new_inode(struct ocfs2_super *osb, int ocfs2_claim_new_inode(struct ocfs2_super *osb,
struct ocfs2_journal_handle *handle, handle_t *handle,
struct ocfs2_alloc_context *ac, struct ocfs2_alloc_context *ac,
u16 *suballoc_bit, u16 *suballoc_bit,
u64 *fe_blkno); u64 *fe_blkno);
int ocfs2_claim_clusters(struct ocfs2_super *osb, int ocfs2_claim_clusters(struct ocfs2_super *osb,
struct ocfs2_journal_handle *handle, handle_t *handle,
struct ocfs2_alloc_context *ac, struct ocfs2_alloc_context *ac,
u32 min_clusters, u32 min_clusters,
u32 *cluster_start, u32 *cluster_start,
u32 *num_clusters); u32 *num_clusters);
int ocfs2_free_dinode(struct ocfs2_journal_handle *handle, int ocfs2_free_dinode(handle_t *handle,
struct inode *inode_alloc_inode, struct inode *inode_alloc_inode,
struct buffer_head *inode_alloc_bh, struct buffer_head *inode_alloc_bh,
struct ocfs2_dinode *di); struct ocfs2_dinode *di);
int ocfs2_free_extent_block(struct ocfs2_journal_handle *handle, int ocfs2_free_extent_block(handle_t *handle,
struct inode *eb_alloc_inode, struct inode *eb_alloc_inode,
struct buffer_head *eb_alloc_bh, struct buffer_head *eb_alloc_bh,
struct ocfs2_extent_block *eb); struct ocfs2_extent_block *eb);
int ocfs2_free_clusters(struct ocfs2_journal_handle *handle, int ocfs2_free_clusters(handle_t *handle,
struct inode *bitmap_inode, struct inode *bitmap_inode,
struct buffer_head *bitmap_bh, struct buffer_head *bitmap_bh,
u64 start_blk, u64 start_blk,
......
...@@ -70,8 +70,6 @@ ...@@ -70,8 +70,6 @@
static kmem_cache_t *ocfs2_inode_cachep = NULL; static kmem_cache_t *ocfs2_inode_cachep = NULL;
kmem_cache_t *ocfs2_lock_cache = NULL;
/* OCFS2 needs to schedule several differnt types of work which /* OCFS2 needs to schedule several differnt types of work which
* require cluster locking, disk I/O, recovery waits, etc. Since these * require cluster locking, disk I/O, recovery waits, etc. Since these
* types of work tend to be heavy we avoid using the kernel events * types of work tend to be heavy we avoid using the kernel events
...@@ -141,6 +139,7 @@ enum { ...@@ -141,6 +139,7 @@ enum {
Opt_hb_local, Opt_hb_local,
Opt_data_ordered, Opt_data_ordered,
Opt_data_writeback, Opt_data_writeback,
Opt_atime_quantum,
Opt_err, Opt_err,
}; };
...@@ -154,6 +153,7 @@ static match_table_t tokens = { ...@@ -154,6 +153,7 @@ static match_table_t tokens = {
{Opt_hb_local, OCFS2_HB_LOCAL}, {Opt_hb_local, OCFS2_HB_LOCAL},
{Opt_data_ordered, "data=ordered"}, {Opt_data_ordered, "data=ordered"},
{Opt_data_writeback, "data=writeback"}, {Opt_data_writeback, "data=writeback"},
{Opt_atime_quantum, "atime_quantum=%u"},
{Opt_err, NULL} {Opt_err, NULL}
}; };
...@@ -707,6 +707,7 @@ static int ocfs2_parse_options(struct super_block *sb, ...@@ -707,6 +707,7 @@ static int ocfs2_parse_options(struct super_block *sb,
while ((p = strsep(&options, ",")) != NULL) { while ((p = strsep(&options, ",")) != NULL) {
int token, option; int token, option;
substring_t args[MAX_OPT_ARGS]; substring_t args[MAX_OPT_ARGS];
struct ocfs2_super * osb = OCFS2_SB(sb);
if (!*p) if (!*p)
continue; continue;
...@@ -747,6 +748,16 @@ static int ocfs2_parse_options(struct super_block *sb, ...@@ -747,6 +748,16 @@ static int ocfs2_parse_options(struct super_block *sb,
case Opt_data_writeback: case Opt_data_writeback:
*mount_opt |= OCFS2_MOUNT_DATA_WRITEBACK; *mount_opt |= OCFS2_MOUNT_DATA_WRITEBACK;
break; break;
case Opt_atime_quantum:
if (match_int(&args[0], &option)) {
status = 0;
goto bail;
}
if (option >= 0)
osb->s_atime_quantum = option;
else
osb->s_atime_quantum = OCFS2_DEFAULT_ATIME_QUANTUM;
break;
default: default:
mlog(ML_ERROR, mlog(ML_ERROR,
"Unrecognized mount option \"%s\" " "Unrecognized mount option \"%s\" "
...@@ -867,7 +878,7 @@ static int ocfs2_statfs(struct dentry *dentry, struct kstatfs *buf) ...@@ -867,7 +878,7 @@ static int ocfs2_statfs(struct dentry *dentry, struct kstatfs *buf)
goto bail; goto bail;
} }
status = ocfs2_meta_lock(inode, NULL, &bh, 0); status = ocfs2_meta_lock(inode, &bh, 0);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
goto bail; goto bail;
...@@ -914,9 +925,7 @@ static void ocfs2_inode_init_once(void *data, ...@@ -914,9 +925,7 @@ static void ocfs2_inode_init_once(void *data,
oi->ip_open_count = 0; oi->ip_open_count = 0;
spin_lock_init(&oi->ip_lock); spin_lock_init(&oi->ip_lock);
ocfs2_extent_map_init(&oi->vfs_inode); ocfs2_extent_map_init(&oi->vfs_inode);
INIT_LIST_HEAD(&oi->ip_handle_list);
INIT_LIST_HEAD(&oi->ip_io_markers); INIT_LIST_HEAD(&oi->ip_io_markers);
oi->ip_handle = NULL;
oi->ip_created_trans = 0; oi->ip_created_trans = 0;
oi->ip_last_trans = 0; oi->ip_last_trans = 0;
oi->ip_dir_start_lookup = 0; oi->ip_dir_start_lookup = 0;
...@@ -948,14 +957,6 @@ static int ocfs2_initialize_mem_caches(void) ...@@ -948,14 +957,6 @@ static int ocfs2_initialize_mem_caches(void)
if (!ocfs2_inode_cachep) if (!ocfs2_inode_cachep)
return -ENOMEM; return -ENOMEM;
ocfs2_lock_cache = kmem_cache_create("ocfs2_lock",
sizeof(struct ocfs2_journal_lock),
0,
SLAB_HWCACHE_ALIGN,
NULL, NULL);
if (!ocfs2_lock_cache)
return -ENOMEM;
return 0; return 0;
} }
...@@ -963,11 +964,8 @@ static void ocfs2_free_mem_caches(void) ...@@ -963,11 +964,8 @@ static void ocfs2_free_mem_caches(void)
{ {
if (ocfs2_inode_cachep) if (ocfs2_inode_cachep)
kmem_cache_destroy(ocfs2_inode_cachep); kmem_cache_destroy(ocfs2_inode_cachep);
if (ocfs2_lock_cache)
kmem_cache_destroy(ocfs2_lock_cache);
ocfs2_inode_cachep = NULL; ocfs2_inode_cachep = NULL;
ocfs2_lock_cache = NULL;
} }
static int ocfs2_get_sector(struct super_block *sb, static int ocfs2_get_sector(struct super_block *sb,
...@@ -1280,6 +1278,8 @@ static int ocfs2_initialize_super(struct super_block *sb, ...@@ -1280,6 +1278,8 @@ static int ocfs2_initialize_super(struct super_block *sb,
init_waitqueue_head(&osb->checkpoint_event); init_waitqueue_head(&osb->checkpoint_event);
atomic_set(&osb->needs_checkpoint, 0); atomic_set(&osb->needs_checkpoint, 0);
osb->s_atime_quantum = OCFS2_DEFAULT_ATIME_QUANTUM;
osb->node_num = O2NM_INVALID_NODE_NUM; osb->node_num = O2NM_INVALID_NODE_NUM;
osb->slot_num = OCFS2_INVALID_SLOT; osb->slot_num = OCFS2_INVALID_SLOT;
......
...@@ -126,6 +126,10 @@ static int ocfs2_readlink(struct dentry *dentry, ...@@ -126,6 +126,10 @@ static int ocfs2_readlink(struct dentry *dentry,
goto out; goto out;
} }
/*
* Without vfsmount we can't update atime now,
* but we will update atime here ultimately.
*/
ret = vfs_readlink(dentry, buffer, buflen, link); ret = vfs_readlink(dentry, buffer, buflen, link);
brelse(bh); brelse(bh);
......
...@@ -1893,6 +1893,7 @@ int should_remove_suid(struct dentry *dentry) ...@@ -1893,6 +1893,7 @@ int should_remove_suid(struct dentry *dentry)
return 0; return 0;
} }
EXPORT_SYMBOL(should_remove_suid);
int __remove_suid(struct dentry *dentry, int kill) int __remove_suid(struct dentry *dentry, int kill)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment