Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 27922b4260f65d317aabda37e42bbbff > files > 1794

kernel-2.6.18-238.el5.src.rpm

From: Mikulas Patocka <mpatocka@redhat.com>
Date: Thu, 9 Sep 2010 21:45:28 -0400
Subject: [md] kcopyd: dm snapshot performance improvement
Message-id: <Pine.LNX.4.64.1009091741240.28911@hs20-bc2-1.build.redhat.com>
Patchwork-id: 28196
O-Subject: [PATCH RHEL5] bz466088: snapshot performance improvement
Bugzilla: 466088
RH-Acked-by: Mike Snitzer <snitzer@redhat.com>

Bugzilla #466088

Testing: basic snapshot tests were run. Performance testing was performed
only on the upstream patch, but because the code is very similar, this
patch will very likely cause performance improvement too.

Backport patch 576197a5ec84bde5889d4ac0df69aa427aa61f48

Improve performance of snapshot writes.

Signed-off-by: Jarod Wilson <jarod@redhat.com>

diff --git a/drivers/md/kcopyd.c b/drivers/md/kcopyd.c
index 30af8a0..337f3fb 100644
--- a/drivers/md/kcopyd.c
+++ b/drivers/md/kcopyd.c
@@ -274,6 +274,16 @@ static inline void push(struct list_head *jobs, struct kcopyd_job *job)
 	spin_unlock_irqrestore(&kc->job_lock, flags);
 }
 
+static inline void push_head(struct list_head *jobs, struct kcopyd_job *job)
+{
+	unsigned long flags;
+	struct kcopyd_client *kc = job->kc;
+
+	spin_lock_irqsave(&kc->job_lock, flags);
+	list_add(&job->list, jobs);
+	spin_unlock_irqrestore(&kc->job_lock, flags);
+}
+
 /*
  * These three functions process 1 item from the corresponding
  * job list.
@@ -405,7 +415,7 @@ static int process_jobs(struct list_head *jobs, struct kcopyd_client *kc,
 			 * We couldn't service this job ATM, so
 			 * push this job back onto the list.
 			 */
-			push(jobs, job);
+			push_head(jobs, job);
 			break;
 		}