mirror of https://github.com/schoebel/mars
logger: disable irqs during spinlocks
This commit is contained in:
parent
bb2f82503c
commit
95ff42b7de
|
@ -117,18 +117,22 @@ EXPORT_SYMBOL_GPL(global_writeback);
|
|||
static
|
||||
void add_to_group(struct writeback_group *gr, struct trans_logger_brick *brick)
|
||||
{
|
||||
write_lock(&gr->lock);
|
||||
unsigned long flags;
|
||||
|
||||
write_lock_irqsave(&gr->lock, flags);
|
||||
list_add_tail(&brick->group_head, &gr->group_anchor);
|
||||
write_unlock(&gr->lock);
|
||||
write_unlock_irqrestore(&gr->lock, flags);
|
||||
}
|
||||
|
||||
static
|
||||
void remove_from_group(struct writeback_group *gr, struct trans_logger_brick *brick)
|
||||
{
|
||||
write_lock(&gr->lock);
|
||||
unsigned long flags;
|
||||
|
||||
write_lock_irqsave(&gr->lock, flags);
|
||||
list_del_init(&brick->group_head);
|
||||
gr->leader = NULL;
|
||||
write_unlock(&gr->lock);
|
||||
write_unlock_irqrestore(&gr->lock, flags);
|
||||
}
|
||||
|
||||
static
|
||||
|
@ -136,6 +140,7 @@ struct trans_logger_brick *elect_leader(struct writeback_group *gr)
|
|||
{
|
||||
struct trans_logger_brick *res = gr->leader;
|
||||
struct list_head *tmp;
|
||||
unsigned long flags;
|
||||
|
||||
if (res && gr->until_percent >= 0) {
|
||||
loff_t used = atomic64_read(&res->shadow_mem_used);
|
||||
|
@ -143,7 +148,7 @@ struct trans_logger_brick *elect_leader(struct writeback_group *gr)
|
|||
goto done;
|
||||
}
|
||||
|
||||
read_lock(&gr->lock);
|
||||
read_lock_irqsave(&gr->lock, flags);
|
||||
for (tmp = gr->group_anchor.next; tmp != &gr->group_anchor; tmp = tmp->next) {
|
||||
struct trans_logger_brick *test = container_of(tmp, struct trans_logger_brick, group_head);
|
||||
loff_t new_used = atomic64_read(&test->shadow_mem_used);
|
||||
|
@ -153,7 +158,7 @@ struct trans_logger_brick *elect_leader(struct writeback_group *gr)
|
|||
gr->biggest = new_used;
|
||||
}
|
||||
}
|
||||
read_unlock(&gr->lock);
|
||||
read_unlock_irqrestore(&gr->lock, flags);
|
||||
|
||||
gr->leader = res;
|
||||
|
||||
|
|
Loading…
Reference in New Issue