Skip to content

Commit

Permalink
dm snapshot: optimize track_chunk
Browse files Browse the repository at this point in the history
track_chunk is always called with interrupts enabled. Consequently, we
do not need to save and restore interrupt state in "flags" variable.
This patch changes spin_lock_irqsave to spin_lock_irq and
spin_unlock_irqrestore to spin_unlock_irq.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
  • Loading branch information
Mikulas Patocka authored and kergon committed Dec 21, 2012
1 parent 19cbbc6 commit 9aa0c0e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/md/dm-snap.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,13 @@ static struct dm_snap_tracked_chunk *track_chunk(struct dm_snapshot *s,
{
struct dm_snap_tracked_chunk *c = mempool_alloc(s->tracked_chunk_pool,
GFP_NOIO);
unsigned long flags;

c->chunk = chunk;

spin_lock_irqsave(&s->tracked_chunk_lock, flags);
spin_lock_irq(&s->tracked_chunk_lock);
hlist_add_head(&c->node,
&s->tracked_chunk_hash[DM_TRACKED_CHUNK_HASH(chunk)]);
spin_unlock_irqrestore(&s->tracked_chunk_lock, flags);
spin_unlock_irq(&s->tracked_chunk_lock);

return c;
}
Expand Down

0 comments on commit 9aa0c0e

Please sign in to comment.