From 982be4bfef38fc8be86f896586cd899dd9994fc8 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Sat, 24 Jan 2009 11:49:34 -0800 Subject: [PATCH 1/1] HAMMER VFS - Remove the unused also_ip argument from the cursor API --- sys/vfs/hammer/hammer.h | 4 ++-- sys/vfs/hammer/hammer_cursor.c | 23 +++++------------------ sys/vfs/hammer/hammer_inode.c | 4 ++-- sys/vfs/hammer/hammer_mirror.c | 8 ++++---- sys/vfs/hammer/hammer_pfs.c | 4 ++-- sys/vfs/hammer/hammer_prune.c | 4 ++-- sys/vfs/hammer/hammer_reblock.c | 16 ++++++++-------- 7 files changed, 25 insertions(+), 38 deletions(-) diff --git a/sys/vfs/hammer/hammer.h b/sys/vfs/hammer/hammer.h index 451e40d93c..83360b199e 100644 --- a/sys/vfs/hammer/hammer.h +++ b/sys/vfs/hammer/hammer.h @@ -930,8 +930,8 @@ int hammer_init_cursor(hammer_transaction_t trans, hammer_cursor_t cursor, void hammer_normalize_cursor(hammer_cursor_t cursor); void hammer_done_cursor(hammer_cursor_t cursor); int hammer_recover_cursor(hammer_cursor_t cursor); -void hammer_unlock_cursor(hammer_cursor_t cursor, int also_ip); -int hammer_lock_cursor(hammer_cursor_t cursor, int also_ip); +void hammer_unlock_cursor(hammer_cursor_t cursor); +int hammer_lock_cursor(hammer_cursor_t cursor); hammer_cursor_t hammer_push_cursor(hammer_cursor_t ocursor); void hammer_pop_cursor(hammer_cursor_t ocursor, hammer_cursor_t ncursor); diff --git a/sys/vfs/hammer/hammer_cursor.c b/sys/vfs/hammer/hammer_cursor.c index 039b238057..7def58895a 100644 --- a/sys/vfs/hammer/hammer_cursor.c +++ b/sys/vfs/hammer/hammer_cursor.c @@ -487,7 +487,7 @@ hammer_cursor_down(hammer_cursor_t cursor) * operations. */ void -hammer_unlock_cursor(hammer_cursor_t cursor, int also_ip) +hammer_unlock_cursor(hammer_cursor_t cursor) { hammer_node_t node; hammer_inode_t ip; @@ -508,9 +508,6 @@ hammer_unlock_cursor(hammer_cursor_t cursor, int also_ip) cursor->flags |= HAMMER_CURSOR_TRACKED; TAILQ_INSERT_TAIL(&node->cursor_list, cursor, deadlk_entry); hammer_unlock(&node->lock); - - if (also_ip && (ip = cursor->ip) != NULL) - hammer_unlock(&ip->lock); } /* @@ -522,7 +519,7 @@ hammer_unlock_cursor(hammer_cursor_t cursor, int also_ip) * the element after it. */ int -hammer_lock_cursor(hammer_cursor_t cursor, int also_ip) +hammer_lock_cursor(hammer_cursor_t cursor) { hammer_inode_t ip; hammer_node_t node; @@ -530,16 +527,6 @@ hammer_lock_cursor(hammer_cursor_t cursor, int also_ip) KKASSERT(cursor->flags & HAMMER_CURSOR_TRACKED); - /* - * Relock the inode - */ - if (also_ip && (ip = cursor->ip) != NULL) { - if (cursor->trans->type == HAMMER_TRANS_FLS) - hammer_lock_ex(&ip->lock); - else - hammer_lock_sh(&ip->lock); - } - /* * Relock the node */ @@ -589,7 +576,7 @@ hammer_recover_cursor(hammer_cursor_t cursor) { int error; - hammer_unlock_cursor(cursor, 0); + hammer_unlock_cursor(cursor); KKASSERT(cursor->trans->sync_lock_refs > 0); /* @@ -606,7 +593,7 @@ hammer_recover_cursor(hammer_cursor_t cursor) hammer_rel_mem_record(cursor->deadlk_rec); cursor->deadlk_rec = NULL; } - error = hammer_lock_cursor(cursor, 0); + error = hammer_lock_cursor(cursor); return(error); } @@ -672,7 +659,7 @@ hammer_pop_cursor(hammer_cursor_t ocursor, hammer_cursor_t ncursor) hammer_done_cursor(ncursor); kfree(ncursor, hmp->m_misc); KKASSERT(ocursor->ip == ip); - hammer_lock_cursor(ocursor, 0); + hammer_lock_cursor(ocursor); } /* diff --git a/sys/vfs/hammer/hammer_inode.c b/sys/vfs/hammer/hammer_inode.c index 537bd19487..73c75de724 100644 --- a/sys/vfs/hammer/hammer_inode.c +++ b/sys/vfs/hammer/hammer_inode.c @@ -2337,9 +2337,9 @@ done: * due to the exclusive sync lock the finalizer must get. */ if (hammer_flusher_meta_limit(hmp)) { - hammer_unlock_cursor(cursor, 0); + hammer_unlock_cursor(cursor); hammer_flusher_finalize(trans, 0); - hammer_lock_cursor(cursor, 0); + hammer_lock_cursor(cursor); } return(error); diff --git a/sys/vfs/hammer/hammer_mirror.c b/sys/vfs/hammer/hammer_mirror.c index 81789ca999..9c97143053 100644 --- a/sys/vfs/hammer/hammer_mirror.c +++ b/sys/vfs/hammer/hammer_mirror.c @@ -359,9 +359,9 @@ hammer_ioc_mirror_write(hammer_transaction_t trans, hammer_inode_t ip, */ while (hammer_flusher_meta_halflimit(trans->hmp) || hammer_flusher_undo_exhausted(trans, 2)) { - hammer_unlock_cursor(&cursor, 0); + hammer_unlock_cursor(&cursor); hammer_flusher_wait(trans->hmp, seq); - hammer_lock_cursor(&cursor, 0); + hammer_lock_cursor(&cursor); seq = hammer_flusher_async_one(trans->hmp); } @@ -374,9 +374,9 @@ hammer_ioc_mirror_write(hammer_transaction_t trans, hammer_inode_t ip, error = ENOSPC; break; } - hammer_unlock_cursor(&cursor, 0); + hammer_unlock_cursor(&cursor); hammer_flusher_wait(trans->hmp, seq); - hammer_lock_cursor(&cursor, 0); + hammer_lock_cursor(&cursor); seq = hammer_flusher_async(trans->hmp, NULL); } diff --git a/sys/vfs/hammer/hammer_pfs.c b/sys/vfs/hammer/hammer_pfs.c index e92b05f2ef..49e8465661 100644 --- a/sys/vfs/hammer/hammer_pfs.c +++ b/sys/vfs/hammer/hammer_pfs.c @@ -411,9 +411,9 @@ retry: while (hammer_flusher_meta_halflimit(trans->hmp) || hammer_flusher_undo_exhausted(trans, 2)) { - hammer_unlock_cursor(&cursor, 0); + hammer_unlock_cursor(&cursor); hammer_flusher_wait(trans->hmp, seq); - hammer_lock_cursor(&cursor, 0); + hammer_lock_cursor(&cursor); seq = hammer_flusher_async_one(trans->hmp); } diff --git a/sys/vfs/hammer/hammer_prune.c b/sys/vfs/hammer/hammer_prune.c index c9baa3a143..63da51ba3f 100644 --- a/sys/vfs/hammer/hammer_prune.c +++ b/sys/vfs/hammer/hammer_prune.c @@ -216,9 +216,9 @@ retry: while (hammer_flusher_meta_halflimit(trans->hmp) || hammer_flusher_undo_exhausted(trans, 2)) { - hammer_unlock_cursor(&cursor, 0); + hammer_unlock_cursor(&cursor); hammer_flusher_wait(trans->hmp, seq); - hammer_lock_cursor(&cursor, 0); + hammer_lock_cursor(&cursor); seq = hammer_flusher_async_one(trans->hmp); } hammer_sync_lock_sh(trans); diff --git a/sys/vfs/hammer/hammer_reblock.c b/sys/vfs/hammer/hammer_reblock.c index d000e669e9..18336e3e06 100644 --- a/sys/vfs/hammer/hammer_reblock.c +++ b/sys/vfs/hammer/hammer_reblock.c @@ -149,9 +149,9 @@ retry: error = ENOSPC; break; } - hammer_unlock_cursor(&cursor, 0); + hammer_unlock_cursor(&cursor); hammer_flusher_wait(trans->hmp, seq); - hammer_lock_cursor(&cursor, 0); + hammer_lock_cursor(&cursor); seq = hammer_flusher_async(trans->hmp, NULL); continue; } @@ -168,9 +168,9 @@ retry: while (hammer_flusher_meta_halflimit(trans->hmp) || hammer_flusher_undo_exhausted(trans, 2)) { - hammer_unlock_cursor(&cursor, 0); + hammer_unlock_cursor(&cursor); hammer_flusher_wait(trans->hmp, seq); - hammer_lock_cursor(&cursor, 0); + hammer_lock_cursor(&cursor); seq = hammer_flusher_async_one(trans->hmp); } @@ -189,9 +189,9 @@ retry: * (The cursor's node and element may change!) */ if (bd_heatup()) { - hammer_unlock_cursor(&cursor, 0); + hammer_unlock_cursor(&cursor); bwillwrite(HAMMER_XBUFSIZE); - hammer_lock_cursor(&cursor, 0); + hammer_lock_cursor(&cursor); } if (error == 0) { @@ -289,9 +289,9 @@ hammer_reblock_helper(struct hammer_ioc_reblock *reblock, * the cursor locked. */ leaf = elm->leaf; - hammer_unlock_cursor(cursor, 0); + hammer_unlock_cursor(cursor); hammer_io_direct_uncache(hmp, &leaf); - hammer_lock_cursor(cursor, 0); + hammer_lock_cursor(cursor); if (cursor->flags & HAMMER_CURSOR_RETEST) { kprintf("hammer: retest after uncache\n"); error = EDEADLK; -- 2.41.0