Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 42377
b: refs/heads/master
c: da5cbf2
h: refs/heads/master
i:
  42375: 0c7f27e
v: v3
  • Loading branch information
Mark Fasheh committed Dec 2, 2006
1 parent 8979991 commit 9dd8ec6
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 153 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8d5596c687c49c1d8812c3456946dec15d069139
refs/heads/master: da5cbf2f9df922cfdafa39351691fa83517f1e25
14 changes: 3 additions & 11 deletions trunk/fs/ocfs2/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,13 +409,6 @@ static int ocfs2_extend_dir(struct ocfs2_super *osb,
mlog(0, "extending dir %llu (i_size = %lld)\n",
(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. */
spin_lock(&OCFS2_I(dir)->ip_lock);
if (dir_i_size == ocfs2_clusters_to_bytes(sb, OCFS2_I(dir)->ip_clusters)) {
Expand All @@ -428,16 +421,15 @@ static int ocfs2_extend_dir(struct ocfs2_super *osb,
}

if (!num_free_extents) {
status = ocfs2_reserve_new_metadata(osb, handle,
fe, &meta_ac);
status = ocfs2_reserve_new_metadata(osb, fe, &meta_ac);
if (status < 0) {
if (status != -ENOSPC)
mlog_errno(status);
goto bail;
}
}

status = ocfs2_reserve_clusters(osb, handle, 1, &data_ac);
status = ocfs2_reserve_clusters(osb, 1, &data_ac);
if (status < 0) {
if (status != -ENOSPC)
mlog_errno(status);
Expand All @@ -450,7 +442,7 @@ static int ocfs2_extend_dir(struct ocfs2_super *osb,
credits = OCFS2_SIMPLE_DIR_EXTEND_CREDITS;
}

handle = ocfs2_start_trans(osb, handle, credits);
handle = ocfs2_start_trans(osb, NULL, credits);
if (IS_ERR(handle)) {
status = PTR_ERR(handle);
handle = NULL;
Expand Down
19 changes: 3 additions & 16 deletions trunk/fs/ocfs2/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -463,13 +463,6 @@ static int ocfs2_extend_allocation(struct inode *inode,
(unsigned long long)OCFS2_I(inode)->ip_blkno, i_size_read(inode),
fe->i_clusters, clusters_to_add);

handle = ocfs2_alloc_handle(osb);
if (handle == NULL) {
status = -ENOMEM;
mlog_errno(status);
goto leave;
}

num_free_extents = ocfs2_num_free_extents(osb,
inode,
fe);
Expand All @@ -480,21 +473,15 @@ static int ocfs2_extend_allocation(struct inode *inode,
}

if (!num_free_extents) {
status = ocfs2_reserve_new_metadata(osb,
handle,
fe,
&meta_ac);
status = ocfs2_reserve_new_metadata(osb, fe, &meta_ac);
if (status < 0) {
if (status != -ENOSPC)
mlog_errno(status);
goto leave;
}
}

status = ocfs2_reserve_clusters(osb,
handle,
clusters_to_add,
&data_ac);
status = ocfs2_reserve_clusters(osb, clusters_to_add, &data_ac);
if (status < 0) {
if (status != -ENOSPC)
mlog_errno(status);
Expand All @@ -509,7 +496,7 @@ static int ocfs2_extend_allocation(struct inode *inode,
drop_alloc_sem = 1;

credits = ocfs2_calc_extend_credits(osb->sb, fe, clusters_to_add);
handle = ocfs2_start_trans(osb, handle, credits);
handle = ocfs2_start_trans(osb, NULL, credits);
if (IS_ERR(handle)) {
status = PTR_ERR(handle);
handle = NULL;
Expand Down
26 changes: 6 additions & 20 deletions trunk/fs/ocfs2/localalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ static int ocfs2_sync_local_to_main(struct ocfs2_super *osb,
struct buffer_head *main_bm_bh);

static int ocfs2_local_alloc_reserve_for_window(struct ocfs2_super *osb,
struct ocfs2_journal_handle *handle,
struct ocfs2_alloc_context **ac,
struct inode **bitmap_inode,
struct buffer_head **bitmap_bh);
Expand Down Expand Up @@ -448,7 +447,6 @@ int ocfs2_complete_local_alloc_recovery(struct ocfs2_super *osb,
* our own in order to shift windows.
*/
int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb,
struct ocfs2_journal_handle *passed_handle,
u32 bits_wanted,
struct ocfs2_alloc_context *ac)
{
Expand All @@ -459,9 +457,7 @@ int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb,

mlog_entry_void();

BUG_ON(!passed_handle);
BUG_ON(!ac);
BUG_ON(passed_handle->k_handle);

local_alloc_inode =
ocfs2_get_system_file_inode(osb,
Expand All @@ -472,7 +468,11 @@ int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb,
mlog_errno(status);
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) {
status = -ENOSPC;
Expand Down Expand Up @@ -511,14 +511,10 @@ int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb,
}
}

ac->ac_inode = igrab(local_alloc_inode);
get_bh(osb->local_alloc_bh);
ac->ac_bh = osb->local_alloc_bh;
ac->ac_which = OCFS2_AC_USE_LOCAL;
status = 0;
bail:
if (local_alloc_inode)
iput(local_alloc_inode);

mlog_exit(status);
return status;
Expand Down Expand Up @@ -774,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,
struct ocfs2_journal_handle *handle,
struct ocfs2_alloc_context **ac,
struct inode **bitmap_inode,
struct buffer_head **bitmap_bh)
Expand All @@ -788,7 +783,6 @@ static int ocfs2_local_alloc_reserve_for_window(struct ocfs2_super *osb,
goto bail;
}

(*ac)->ac_handle = handle;
(*ac)->ac_bits_wanted = ocfs2_local_alloc_window_bits(osb);

status = ocfs2_reserve_cluster_bitmap_bits(osb, *ac);
Expand Down Expand Up @@ -891,16 +885,8 @@ static int ocfs2_local_alloc_slide_window(struct ocfs2_super *osb,

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. */
status = ocfs2_local_alloc_reserve_for_window(osb,
handle,
&ac,
&main_bm_inode,
&main_bm_bh);
Expand All @@ -910,7 +896,7 @@ static int ocfs2_local_alloc_slide_window(struct ocfs2_super *osb,
goto bail;
}

handle = ocfs2_start_trans(osb, handle, OCFS2_WINDOW_MOVE_CREDITS);
handle = ocfs2_start_trans(osb, NULL, OCFS2_WINDOW_MOVE_CREDITS);
if (IS_ERR(handle)) {
status = PTR_ERR(handle);
handle = NULL;
Expand Down
1 change: 0 additions & 1 deletion trunk/fs/ocfs2/localalloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ int ocfs2_alloc_should_use_local(struct ocfs2_super *osb,

struct ocfs2_alloc_context;
int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb,
struct ocfs2_journal_handle *passed_handle,
u32 bits_wanted,
struct ocfs2_alloc_context *ac);

Expand Down
26 changes: 6 additions & 20 deletions trunk/fs/ocfs2/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,13 +334,6 @@ static int ocfs2_mknod(struct inode *dir,
return status;
}

handle = ocfs2_alloc_handle(osb);
if (handle == NULL) {
status = -ENOMEM;
mlog_errno(status);
goto leave;
}

if (S_ISDIR(mode) && (dir->i_nlink >= OCFS2_LINK_MAX)) {
status = -EMLINK;
goto leave;
Expand Down Expand Up @@ -368,7 +361,7 @@ static int ocfs2_mknod(struct inode *dir,
}

/* reserve an inode spot */
status = ocfs2_reserve_new_inode(osb, handle, &inode_ac);
status = ocfs2_reserve_new_inode(osb, &inode_ac);
if (status < 0) {
if (status != -ENOSPC)
mlog_errno(status);
Expand All @@ -378,15 +371,15 @@ static int ocfs2_mknod(struct inode *dir,
/* are we making a directory? If so, reserve a cluster for his
* 1st extent. */
if (S_ISDIR(mode)) {
status = ocfs2_reserve_clusters(osb, handle, 1, &data_ac);
status = ocfs2_reserve_clusters(osb, 1, &data_ac);
if (status < 0) {
if (status != -ENOSPC)
mlog_errno(status);
goto leave;
}
}

handle = ocfs2_start_trans(osb, handle, OCFS2_MKNOD_CREDITS);
handle = ocfs2_start_trans(osb, NULL, OCFS2_MKNOD_CREDITS);
if (IS_ERR(handle)) {
status = PTR_ERR(handle);
handle = NULL;
Expand Down Expand Up @@ -1649,14 +1642,7 @@ static int ocfs2_symlink(struct inode *dir,
goto bail;
}

handle = ocfs2_alloc_handle(osb);
if (handle == NULL) {
status = -ENOMEM;
mlog_errno(status);
goto bail;
}

status = ocfs2_reserve_new_inode(osb, handle, &inode_ac);
status = ocfs2_reserve_new_inode(osb, &inode_ac);
if (status < 0) {
if (status != -ENOSPC)
mlog_errno(status);
Expand All @@ -1665,15 +1651,15 @@ static int ocfs2_symlink(struct inode *dir,

/* don't reserve bitmap space for fast symlinks. */
if (l > ocfs2_fast_symlink_chars(sb)) {
status = ocfs2_reserve_clusters(osb, handle, 1, &data_ac);
status = ocfs2_reserve_clusters(osb, 1, &data_ac);
if (status < 0) {
if (status != -ENOSPC)
mlog_errno(status);
goto bail;
}
}

handle = ocfs2_start_trans(osb, handle, credits);
handle = ocfs2_start_trans(osb, NULL, credits);
if (IS_ERR(handle)) {
status = PTR_ERR(handle);
handle = NULL;
Expand Down
Loading

0 comments on commit 9dd8ec6

Please sign in to comment.