mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 19:01:57 -04: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
|
||||
|
|
|
|||
|
|
@ -379,7 +379,6 @@ struct snapraid_disk {
|
|||
* change during multithread processing.
|
||||
*/
|
||||
thread_mutex_t fs_mutex;
|
||||
int fs_mutex_enabled; /*< If the lock has to be used. */
|
||||
|
||||
/**
|
||||
* Mutex for protecting the scan process.
|
||||
|
|
@ -997,11 +996,6 @@ struct snapraid_disk* disk_alloc(const char* name, const char* dir, uint64_t dev
|
|||
*/
|
||||
void disk_free(struct snapraid_disk* disk);
|
||||
|
||||
/**
|
||||
* Enable multithread support for the disk.
|
||||
*/
|
||||
void disk_start_thread(struct snapraid_disk* disk);
|
||||
|
||||
/**
|
||||
* Get the size of the disk in blocks.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -812,13 +812,6 @@ static void io_start_thread(struct snapraid_io* io,
|
|||
bit_vect_t* block_enabled)
|
||||
{
|
||||
unsigned i;
|
||||
tommy_node* j;
|
||||
|
||||
/* enable the filesystem mutex in all disks */
|
||||
for (j = io->state->disklist; j != 0; j = j->next) {
|
||||
struct snapraid_disk* disk = j->data;
|
||||
disk_start_thread(disk);
|
||||
}
|
||||
|
||||
io->block_start = blockstart;
|
||||
io->block_max = blockmax;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue