]> wimlib.net Git - wimlib/commitdiff
Remove i_mutex (not really worth the extra time/memory I think)
authorEric Biggers <ebiggers3@gmail.com>
Wed, 22 May 2013 23:20:53 +0000 (18:20 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Wed, 22 May 2013 23:20:53 +0000 (18:20 -0500)
include/wimlib/dentry.h
src/dentry.c
src/mount_image.c

index 0871edc2d418894edc160743346ca3ae523091ce..9e24529a2d5229b596687223d87a9abeb8d7e3c8 100644 (file)
 #include <string.h>
 #include <sys/types.h> /* uid_t, gid_t */
 
-#ifdef WITH_FUSE
-#  include <pthread.h>
-#endif
-
 struct wim_lookup_table;
 struct wim_lookup_table_entry;
 struct wimfs_fd;
@@ -382,10 +378,6 @@ struct wim_inode {
        u16 i_num_opened_fds;
        u16 i_num_allocated_fds;
        struct wimfs_fd **i_fds;
-       /* This mutex protects the inode's file descriptors table during
-        * read-only mounts.  Read-write mounts are still restricted to 1
-        * thread. */
-       pthread_mutex_t i_mutex;
 #endif
 };
 
index d6eb8a5c737f3942e80d4b753ea47a314ff697ce..451d412f037f523a24e2f58ad58d93cd29cf0280 100644 (file)
@@ -983,13 +983,6 @@ new_timeless_inode(void)
                inode->i_next_stream_id = 1;
                inode->i_not_rpfixed = 1;
                INIT_LIST_HEAD(&inode->i_list);
-       #ifdef WITH_FUSE
-               if (pthread_mutex_init(&inode->i_mutex, NULL) != 0) {
-                       ERROR_WITH_ERRNO("Error initializing mutex");
-                       FREE(inode);
-                       return NULL;
-               }
-       #endif
                INIT_LIST_HEAD(&inode->i_dentry);
        }
        return inode;
@@ -1131,7 +1124,6 @@ free_inode(struct wim_inode *inode)
        #ifdef WITH_FUSE
                wimlib_assert(inode->i_num_opened_fds == 0);
                FREE(inode->i_fds);
-               pthread_mutex_destroy(&inode->i_mutex);
        #endif
                /* HACK: This may instead delete the inode from i_list, but the
                 * hlist_del() behaves the same as list_del(). */
index a207b42a6fd449e883e30e2f27741e42cf59db0d..d9a03a998febc11e2ecc2bb932d956a164be8551 100644 (file)
@@ -194,8 +194,6 @@ alloc_wimfs_fd(struct wim_inode *inode,
        static const u16 max_fds = 0xffff;
        int ret;
 
-       pthread_mutex_lock(&inode->i_mutex);
-
        DEBUG("Allocating fd for stream ID %u from inode %#"PRIx64" "
              "(open = %u, allocated = %u)",
              stream_id, inode->i_ino, inode->i_num_opened_fds,
@@ -247,7 +245,6 @@ alloc_wimfs_fd(struct wim_inode *inode,
                }
        }
 out:
-       pthread_mutex_unlock(&inode->i_mutex);
        return ret;
 }
 
@@ -255,9 +252,6 @@ static void
 inode_put_fd(struct wim_inode *inode, struct wimfs_fd *fd)
 {
        wimlib_assert(inode != NULL);
-
-       pthread_mutex_lock(&inode->i_mutex);
-
        wimlib_assert(fd->f_inode == inode);
        wimlib_assert(inode->i_num_opened_fds != 0);
        wimlib_assert(fd->idx < inode->i_num_allocated_fds);
@@ -265,12 +259,8 @@ inode_put_fd(struct wim_inode *inode, struct wimfs_fd *fd)
 
        inode->i_fds[fd->idx] = NULL;
        FREE(fd);
-       if (--inode->i_num_opened_fds == 0 && inode->i_nlink == 0) {
-               pthread_mutex_unlock(&inode->i_mutex);
+       if (--inode->i_num_opened_fds == 0 && inode->i_nlink == 0)
                free_inode(inode);
-       } else {
-               pthread_mutex_unlock(&inode->i_mutex);
-       }
 }
 
 static int
@@ -2475,12 +2465,11 @@ wimlib_mount_image(WIMStruct *wim, int image, const char *dir,
                goto out_free_message_queue_names;
 
        argc = 0;
-       argv[argc++] = "imagex";
+       argv[argc++] = IMAGEX_PROGNAME;
        argv[argc++] = dir_copy;
 
-       /* disable multi-threaded operation for read-write mounts */
-       if (mount_flags & WIMLIB_MOUNT_FLAG_READWRITE)
-               argv[argc++] = "-s";
+       /* disable multi-threaded operation */
+       argv[argc++] = "-s";
 
        if (mount_flags & WIMLIB_MOUNT_FLAG_DEBUG)
                argv[argc++] = "-d";