hammer2 - locking revamp (2)
authorMatthew Dillon <dillon@apollo.backplane.com>
Mon, 23 Mar 2015 04:54:32 +0000 (21:54 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Mon, 23 Mar 2015 04:54:32 +0000 (21:54 -0700)
* Update mutex lock calls to not pass the ident.

sys/vfs/hammer2/hammer2_chain.c
sys/vfs/hammer2/hammer2_flush.c
sys/vfs/hammer2/hammer2_inode.c
sys/vfs/hammer2/hammer2_subr.c
sys/vfs/hammer2/hammer2_vfsops.c
sys/vfs/hammer2/hammer2_vnops.c

index a67f270..5bfa44c 100644 (file)
@@ -236,7 +236,7 @@ hammer2_chain_core_alloc(hammer2_trans_t *trans, hammer2_chain_t *chain)
         * sub-tree).
         */
        RB_INIT(&core->rbtree); /* live chains */
-       hammer2_mtx_init(&core->lock, "h2chn");
+       hammer2_mtx_init(&core->lock, "h2chain");
 }
 
 /*
@@ -574,9 +574,9 @@ hammer2_chain_lock(hammer2_chain_t *chain, int how)
         * Get the appropriate lock.
         */
        if (how & HAMMER2_RESOLVE_SHARED)
-               hammer2_mtx_sh(&chain->core.lock, "h2chnx");
+               hammer2_mtx_sh(&chain->core.lock);
        else
-               hammer2_mtx_ex(&chain->core.lock, "h2chns");
+               hammer2_mtx_ex(&chain->core.lock);
 
        /*
         * If we already have a valid data pointer no further action is
@@ -2161,7 +2161,7 @@ hammer2_chain_create(hammer2_trans_t *trans, hammer2_chain_t **parentp,
                 * to 1 by chain_alloc() for us, but lockcnt is not).
                 */
                chain->lockcnt = 1;
-               hammer2_mtx_ex(&chain->core.lock, "h2chnx");
+               hammer2_mtx_ex(&chain->core.lock);
                allocated = 1;
 
                /*
index 812b912..f8d5309 100644 (file)
@@ -239,9 +239,8 @@ hammer2_trans_init(hammer2_trans_t *trans, hammer2_pfsmount_t *pmp, int flags)
                    TAILQ_FIRST(&tman->transq) != head) {
                        trans->blocked = 1;
                        while (trans->blocked) {
-                               lksleep(&trans->sync_xid,
-                                       &tman->translk, 0,
-                                       "h2multf", hz);
+                               lksleep(&trans->sync_xid, &tman->translk,
+                                       0, "h2multf", hz);
                        }
                }
        }
index 12b7c2f..1cb503d 100644 (file)
@@ -97,7 +97,7 @@ hammer2_inode_lock_nex(hammer2_inode_t *ip, int how)
        int i;
 
        hammer2_inode_ref(ip);
-       hammer2_mtx_ex(&ip->lock, "h2ino");
+       hammer2_mtx_ex(&ip->lock);
        cluster = hammer2_cluster_copy(&ip->cluster,
                                       HAMMER2_CLUSTER_COPY_NOCHAINS);
 
@@ -168,7 +168,7 @@ hammer2_inode_lock_sh(hammer2_inode_t *ip)
        hammer2_inode_ref(ip);
        cluster = hammer2_cluster_copy(&ip->cluster,
                                       HAMMER2_CLUSTER_COPY_NOCHAINS);
-       hammer2_mtx_sh(&ip->lock, "h2ino");
+       hammer2_mtx_sh(&ip->lock);
 
        cluster->focus = NULL;
 
@@ -228,7 +228,7 @@ hammer2_inode_lock_temp_release(hammer2_inode_t *ip)
 void
 hammer2_inode_lock_temp_restore(hammer2_inode_t *ip, hammer2_mtx_state_t ostate)
 {
-       hammer2_mtx_temp_restore(&ip->lock, "h2ino", ostate);
+       hammer2_mtx_temp_restore(&ip->lock, ostate);
 }
 
 /*
@@ -249,7 +249,7 @@ hammer2_inode_lock_upgrade(hammer2_inode_t *ip)
                wasexclusive = 1;
        } else {
                hammer2_mtx_unlock(&ip->lock);
-               hammer2_mtx_ex(&ip->lock, "h2upg");
+               hammer2_mtx_ex(&ip->lock);
                wasexclusive = 0;
        }
        return wasexclusive;
@@ -549,7 +549,7 @@ again:
                if (nip == NULL)
                        break;
 
-               hammer2_mtx_ex(&nip->lock, "h2ino");
+               hammer2_mtx_ex(&nip->lock);
 
                /*
                 * Handle SMP race (not applicable to the super-root spmp
@@ -599,8 +599,8 @@ again:
         * hammer2_inode_lock_ex() call.
         */
        nip->refs = 1;
-       hammer2_mtx_init(&nip->lock, "h2ino");
-       hammer2_mtx_ex(&nip->lock, "h2ino");
+       hammer2_mtx_init(&nip->lock, "h2inode");
+       hammer2_mtx_ex(&nip->lock);
        /* combination of thread lock and chain lock == inode lock */
 
        /*
index af479f8..b4c7c32 100644 (file)
 void
 hammer2_mount_exlock(hammer2_mount_t *hmp)
 {
-       hammer2_mtx_ex(&hmp->vchain.core.lock, "h2mount");
+       hammer2_mtx_ex(&hmp->vchain.core.lock);
 }
 
 void
 hammer2_mount_shlock(hammer2_mount_t *hmp)
 {
-       hammer2_mtx_sh(&hmp->vchain.core.lock, "h2mount");
+       hammer2_mtx_sh(&hmp->vchain.core.lock);
 }
 
 void
index 83c29ef..88028f3 100644 (file)
@@ -741,7 +741,7 @@ hammer2_vfs_mount(struct mount *mp, char *path, caddr_t data,
                 * hammer2_inode_lock*().
                 */
                hammer2_inode_ref(pmp->iroot);
-               hammer2_mtx_ex(&pmp->iroot->lock, "h2ino");
+               hammer2_mtx_ex(&pmp->iroot->lock);
 
                if (pmp->iroot->cluster.nchains + cluster->nchains >
                    HAMMER2_MAXCLUSTER) {
@@ -890,7 +890,7 @@ hammer2_write_thread(void *arg)
        
        pmp = arg;
        
-       hammer2_mtx_ex(&pmp->wthread_mtx, "h2wth");
+       hammer2_mtx_ex(&pmp->wthread_mtx);
        while (pmp->wthread_destroy == 0) {
                if (bioq_first(&pmp->wthread_bioq) == NULL) {
                        mtxsleep(&pmp->wthread_bioq, &pmp->wthread_mtx,
@@ -957,7 +957,7 @@ hammer2_write_thread(void *arg)
                                bp->b_error = EIO;
                        }
                        biodone(bio);
-                       hammer2_mtx_ex(&pmp->wthread_mtx, "h2wth");
+                       hammer2_mtx_ex(&pmp->wthread_mtx);
                }
                hammer2_trans_done(&trans);
        }
@@ -973,7 +973,7 @@ hammer2_bioq_sync(hammer2_pfsmount_t *pmp)
        struct bio sync_bio;
 
        bzero(&sync_bio, sizeof(sync_bio));     /* dummy with no bio_buf */
-       hammer2_mtx_ex(&pmp->wthread_mtx, "h2wth");
+       hammer2_mtx_ex(&pmp->wthread_mtx);
        if (pmp->wthread_destroy == 0 &&
            TAILQ_FIRST(&pmp->wthread_bioq.queue)) {
                bioq_insert_tail(&pmp->wthread_bioq, &sync_bio);
@@ -1593,7 +1593,7 @@ hammer2_vfs_unmount(struct mount *mp, int mntflags)
        }
 
        if (pmp->wthread_td) {
-               hammer2_mtx_ex(&pmp->wthread_mtx, "h2wth");
+               hammer2_mtx_ex(&pmp->wthread_mtx);
                pmp->wthread_destroy = 1;
                wakeup(&pmp->wthread_bioq);
                while (pmp->wthread_destroy != -1) {
index 75a969c..71aaab4 100644 (file)
@@ -941,7 +941,7 @@ hammer2_read_file(hammer2_inode_t *ip, struct uio *uio, int seqcount)
         * WARNING! Assumes that the kernel interlocks size changes at the
         *          vnode level.
         */
-       hammer2_mtx_sh(&ip->lock, "h2ino");
+       hammer2_mtx_sh(&ip->lock);
        size = ip->size;
        hammer2_mtx_unlock(&ip->lock);
 
@@ -998,7 +998,7 @@ hammer2_write_file(hammer2_inode_t *ip,
         * WARNING! Assumes that the kernel interlocks size changes at the
         *          vnode level.
         */
-       hammer2_mtx_ex(&ip->lock, "h2ino");
+       hammer2_mtx_ex(&ip->lock);
        if (ioflag & IO_APPEND)
                uio->uio_offset = ip->size;
        old_eof = ip->size;
@@ -1149,7 +1149,7 @@ hammer2_write_file(hammer2_inode_t *ip,
        if (error && new_eof != old_eof) {
                hammer2_truncate_file(ip, old_eof);
        } else if (modified) {
-               hammer2_mtx_ex(&ip->lock, "h2ino");
+               hammer2_mtx_ex(&ip->lock);
                hammer2_update_time(&ip->mtime);
                atomic_set_int(&ip->flags, HAMMER2_INODE_MTIME);
                hammer2_mtx_unlock(&ip->lock);
@@ -1186,7 +1186,7 @@ hammer2_truncate_file(hammer2_inode_t *ip, hammer2_key_t nsize)
                           nblksize, (int)nsize & (nblksize - 1),
                           0);
        }
-       hammer2_mtx_ex(&ip->lock, "h2ino");
+       hammer2_mtx_ex(&ip->lock);
        ip->size = nsize;
        atomic_set_int(&ip->flags, HAMMER2_INODE_RESIZED);
        hammer2_mtx_unlock(&ip->lock);
@@ -1211,7 +1211,7 @@ hammer2_extend_file(hammer2_inode_t *ip, hammer2_key_t nsize)
        int nblksize;
 
        LOCKSTART;
-       hammer2_mtx_ex(&ip->lock, "h2ino");
+       hammer2_mtx_ex(&ip->lock);
        osize = ip->size;
        ip->size = nsize;
        hammer2_mtx_unlock(&ip->lock);
@@ -2328,7 +2328,7 @@ hammer2_strategy_write(struct vop_strategy_args *ap)
        pmp = ip->pmp;
        
        hammer2_lwinprog_ref(pmp);
-       hammer2_mtx_ex(&pmp->wthread_mtx, "h2wth");
+       hammer2_mtx_ex(&pmp->wthread_mtx);
        if (TAILQ_EMPTY(&pmp->wthread_bioq.queue)) {
                bioq_insert_tail(&pmp->wthread_bioq, ap->a_bio);
                hammer2_mtx_unlock(&pmp->wthread_mtx);