[PATCH 1/2] raid5-cache: destroy mempool

Subsystems: software raid (multiple disks) support, the rest

STALE3865d

5 messages, 2 authors, 2016-01-06 · open the first message on its own page

[PATCH 1/2] raid5-cache: destroy mempool

From: Shaohua Li <hidden>
Date: 2016-01-05 00:43:06

io_unit mempool isn't destroied with recent changes.

Signed-off-by: Shaohua Li <redacted>
---
 drivers/md/raid5-cache.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/drivers/md/raid5-cache.c b/drivers/md/raid5-cache.c
index d992d62..55a905e 100644
--- a/drivers/md/raid5-cache.c
+++ b/drivers/md/raid5-cache.c
@@ -1257,6 +1257,7 @@ void r5l_exit_log(struct r5l_log *log)
 	md_unregister_thread(&log->reclaim_thread);
 	mempool_destroy(log->meta_pool);
 	bioset_free(log->bs);
+	mempool_destroy(log->io_pool);
 	kmem_cache_destroy(log->io_kc);
 	kfree(log);
 }
-- 
2.4.6

[PATCH 2/2] raid5-cache: correctly handle stripe with enough journal space

From: Shaohua Li <hidden>
Date: 2016-01-05 00:43:07

If there are spaces in journal, we do nothing. Likely a typo merging
recent io_unit mempool patch.

Signed-off-by: Shaohua Li <redacted>
---
 drivers/md/raid5-cache.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/md/raid5-cache.c b/drivers/md/raid5-cache.c
index 55a905e..d242a36 100644
--- a/drivers/md/raid5-cache.c
+++ b/drivers/md/raid5-cache.c
@@ -494,19 +494,19 @@ int r5l_write_stripe(struct r5l_log *log, struct stripe_head *sh)
 	mutex_lock(&log->io_mutex);
 	/* meta + data */
 	reserve = (1 + write_disks) << (PAGE_SHIFT - 9);
-	if (!r5l_has_free_space(log, reserve)) {
-		spin_lock(&log->no_space_stripes_lock);
-		list_add_tail(&sh->log_list, &log->no_space_stripes);
-		spin_unlock(&log->no_space_stripes_lock);
-
-		r5l_wake_reclaim(log, reserve);
-
+	if (r5l_has_free_space(log, reserve)) {
 		ret = r5l_log_stripe(log, sh, data_pages, parity_pages);
 		if (ret) {
 			spin_lock_irq(&log->io_list_lock);
 			list_add_tail(&sh->log_list, &log->no_mem_stripes);
 			spin_unlock_irq(&log->io_list_lock);
 		}
+	} else {
+		spin_lock(&log->no_space_stripes_lock);
+		list_add_tail(&sh->log_list, &log->no_space_stripes);
+		spin_unlock(&log->no_space_stripes_lock);
+
+		r5l_wake_reclaim(log, reserve);
 	}
 
 	mutex_unlock(&log->io_mutex);
-- 
2.4.6

Re: [PATCH 1/2] raid5-cache: destroy mempool

From: NeilBrown <hidden>
Date: 2016-01-06 01:50:19

On Tue, Jan 05 2016, Shaohua Li wrote:
quoted hunk
io_unit mempool isn't destroied with recent changes.

Signed-off-by: Shaohua Li <redacted>
---
 drivers/md/raid5-cache.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/drivers/md/raid5-cache.c b/drivers/md/raid5-cache.c
index d992d62..55a905e 100644
--- a/drivers/md/raid5-cache.c
+++ b/drivers/md/raid5-cache.c
@@ -1257,6 +1257,7 @@ void r5l_exit_log(struct r5l_log *log)
 	md_unregister_thread(&log->reclaim_thread);
 	mempool_destroy(log->meta_pool);
 	bioset_free(log->bs);
+	mempool_destroy(log->io_pool);
 	kmem_cache_destroy(log->io_kc);
 	kfree(log);
 }
Thanks!
I've merge that into the offending patch rather than adding it as a
separate patch.

NeilBrown

Re: [PATCH 2/2] raid5-cache: correctly handle stripe with enough journal space

From: NeilBrown <hidden>
Date: 2016-01-06 01:54:28

On Tue, Jan 05 2016, Shaohua Li wrote:
If there are spaces in journal, we do nothing. Likely a typo merging
recent io_unit mempool patch.
Very likely.

I think the same effect as your patch can be achieved with
diff --git a/drivers/md/raid5-cache.c b/drivers/md/raid5-cache.c
index 55a905e56e8a..6d2b4789a928 100644
--- a/drivers/md/raid5-cache.c
+++ b/drivers/md/raid5-cache.c
@@ -500,7 +500,7 @@ int r5l_write_stripe(struct r5l_log *log, struct stripe_head *sh)
 		spin_unlock(&log->no_space_stripes_lock);
 
 		r5l_wake_reclaim(log, reserve);
-
+	} else {
 		ret = r5l_log_stripe(log, sh, data_pages, parity_pages);
 		if (ret) {
 			spin_lock_irq(&log->io_list_lock);
Are you OK with me just merging that into the offending patch?

Thanks,
NeilBrown
quoted hunk
Signed-off-by: Shaohua Li <redacted>
---
 drivers/md/raid5-cache.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/md/raid5-cache.c b/drivers/md/raid5-cache.c
index 55a905e..d242a36 100644
--- a/drivers/md/raid5-cache.c
+++ b/drivers/md/raid5-cache.c
@@ -494,19 +494,19 @@ int r5l_write_stripe(struct r5l_log *log, struct stripe_head *sh)
 	mutex_lock(&log->io_mutex);
 	/* meta + data */
 	reserve = (1 + write_disks) << (PAGE_SHIFT - 9);
-	if (!r5l_has_free_space(log, reserve)) {
-		spin_lock(&log->no_space_stripes_lock);
-		list_add_tail(&sh->log_list, &log->no_space_stripes);
-		spin_unlock(&log->no_space_stripes_lock);
-
-		r5l_wake_reclaim(log, reserve);
-
+	if (r5l_has_free_space(log, reserve)) {
 		ret = r5l_log_stripe(log, sh, data_pages, parity_pages);
 		if (ret) {
 			spin_lock_irq(&log->io_list_lock);
 			list_add_tail(&sh->log_list, &log->no_mem_stripes);
 			spin_unlock_irq(&log->io_list_lock);
 		}
+	} else {
+		spin_lock(&log->no_space_stripes_lock);
+		list_add_tail(&sh->log_list, &log->no_space_stripes);
+		spin_unlock(&log->no_space_stripes_lock);
+
+		r5l_wake_reclaim(log, reserve);
 	}
 
 	mutex_unlock(&log->io_mutex);
-- 
2.4.6

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Re: [PATCH 2/2] raid5-cache: correctly handle stripe with enough journal space

From: Shaohua Li <hidden>
Date: 2016-01-06 01:55:44

On Wed, Jan 06, 2016 at 12:54:28PM +1100, NeilBrown wrote:
quoted hunk
On Tue, Jan 05 2016, Shaohua Li wrote:
quoted
If there are spaces in journal, we do nothing. Likely a typo merging
recent io_unit mempool patch.
Very likely.

I think the same effect as your patch can be achieved with
diff --git a/drivers/md/raid5-cache.c b/drivers/md/raid5-cache.c
index 55a905e56e8a..6d2b4789a928 100644
--- a/drivers/md/raid5-cache.c
+++ b/drivers/md/raid5-cache.c
@@ -500,7 +500,7 @@ int r5l_write_stripe(struct r5l_log *log, struct stripe_head *sh)
 		spin_unlock(&log->no_space_stripes_lock);
 
 		r5l_wake_reclaim(log, reserve);
-
+	} else {
 		ret = r5l_log_stripe(log, sh, data_pages, parity_pages);
 		if (ret) {
 			spin_lock_irq(&log->io_list_lock);
Are you OK with me just merging that into the offending patch?
sure, please go ahead
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help