mirror of
https://github.com/amadvance/snapraid.git
synced 2026-12-05 06:10:13 -05:00
Always use the mutex when scanning disks
This commit is contained in:
parent
ee197c7920
commit
2b1e356099
3 changed files with 2 additions and 27 deletions
|
|
@ -766,7 +766,6 @@ struct snapraid_disk* disk_alloc(const char* name, const char* dir, uint64_t dev
|
|||
|
||||
#if HAVE_THREAD
|
||||
thread_mutex_init(&disk->fs_mutex);
|
||||
disk->fs_mutex_enabled = 0; /* lock will be enabled at threads start */
|
||||
#endif
|
||||
|
||||
disk->smartctl[0] = 0;
|
||||
|
|
@ -825,20 +824,10 @@ void disk_free(struct snapraid_disk* disk)
|
|||
free(disk);
|
||||
}
|
||||
|
||||
void disk_start_thread(struct snapraid_disk* disk)
|
||||
{
|
||||
#if HAVE_THREAD
|
||||
disk->fs_mutex_enabled = 1;
|
||||
#else
|
||||
(void)disk;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void fs_lock(struct snapraid_disk* disk)
|
||||
{
|
||||
#if HAVE_THREAD
|
||||
if (disk->fs_mutex_enabled)
|
||||
thread_mutex_lock(&disk->fs_mutex);
|
||||
thread_mutex_lock(&disk->fs_mutex);
|
||||
#else
|
||||
(void)disk;
|
||||
#endif
|
||||
|
|
@ -847,8 +836,7 @@ static inline void fs_lock(struct snapraid_disk* disk)
|
|||
static inline void fs_unlock(struct snapraid_disk* disk)
|
||||
{
|
||||
#if HAVE_THREAD
|
||||
if (disk->fs_mutex_enabled)
|
||||
thread_mutex_unlock(&disk->fs_mutex);
|
||||
thread_mutex_unlock(&disk->fs_mutex);
|
||||
#else
|
||||
(void)disk;
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue