FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Device-mapper Development

 
 
LinkBack Thread Tools
 
Old 07-16-2012, 10:39 PM
Mikulas Patocka
 
Default dm-thin: don't send discards to shared blocks

Hi

This patch prevents dm-thin from sending discards to shared blocks. It is
an upstream bug, so it should be sent upstream now (preferably before 3.5
comes out).

Mikulas

---

dm-thin: don't send discards to shared blocks

When process_discard receives a partial discard that doesn't cover full
block, it sends this discard down to that block. Unfortunatelly, the
block can be shared and the discard would corrupt the other snapshots
sharing this block.

This patch detects block sharing and ends the discard with sucess when
sending it to the shared block.

The above change causes that if the device supports discard it can't be
guaranteed that a discard request zeroes data. Therefore, we set
ti->discard_zeroes_data_unsupported.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@kernel.org

---
drivers/md/dm-thin.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

Index: linux-3.5-rc6-fast/drivers/md/dm-thin.c
================================================== =================
--- linux-3.5-rc6-fast.orig/drivers/md/dm-thin.c 2012-07-16 21:47:46.000000000 +0200
+++ linux-3.5-rc6-fast/drivers/md/dm-thin.c 2012-07-17 00:35:25.000000000 +0200
@@ -1259,7 +1259,10 @@ static void process_discard(struct thin_

cell_release_singleton(cell, bio);
cell_release_singleton(cell2, bio);
- remap_and_issue(tc, bio, lookup_result.block);
+ if ((!lookup_result.shared) & pool->pf.discard_passdown)
+ remap_and_issue(tc, bio, lookup_result.block);
+ else
+ bio_endio(bio, 0);
}
break;

@@ -2648,6 +2651,7 @@ static int thin_ctr(struct dm_target *ti
if (tc->pool->pf.discard_enabled) {
ti->discards_supported = 1;
ti->num_discard_requests = 1;
+ ti->discard_zeroes_data_unsupported = 1;
}

dm_put(pool_md);

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
 
Old 07-18-2012, 12:15 PM
Joe Thornber
 
Default dm-thin: don't send discards to shared blocks

Ack, but ...

On Mon, Jul 16, 2012 at 06:39:33PM -0400, Mikulas Patocka wrote:
> --- linux-3.5-rc6-fast.orig/drivers/md/dm-thin.c 2012-07-16 21:47:46.000000000 +0200
> +++ linux-3.5-rc6-fast/drivers/md/dm-thin.c 2012-07-17 00:35:25.000000000 +0200
> @@ -1259,7 +1259,10 @@ static void process_discard(struct thin_
>
> cell_release_singleton(cell, bio);
> cell_release_singleton(cell2, bio);
> - remap_and_issue(tc, bio, lookup_result.block);
> + if ((!lookup_result.shared) & pool->pf.discard_passdown)

... I'd rather a logical && there.

- Joe

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
 

Thread Tools




All times are GMT. The time now is 10:56 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org