Thread (34 messages) 34 messages, 6 authors, 2014-09-09

Re: [RFC 5/9] SQUASHME: prd: Last fixes for partitions

From: Boaz Harrosh <hidden>
Date: 2014-08-14 13:04:53
Also in: linux-fsdevel

On 08/13/2014 03:16 PM, Boaz Harrosh wrote:
quoted hunk ↗ jump to hunk
From: Boaz Harrosh <redacted>

This streamlines prd with the latest brd code.

In prd we do not allocate new devices dynamically on devnod
access, because we need parameterization of each device. So
the dynamic allocation in prd_init_one is removed.

Therefor prd_init_one only called from prd_prob is moved
there, now that it is small.

And other small fixes regarding partitions

Signed-off-by: Boaz Harrosh <redacted>
---
 drivers/block/prd.c | 47 ++++++++++++++++++++++++-----------------------
 1 file changed, 24 insertions(+), 23 deletions(-)
diff --git a/drivers/block/prd.c b/drivers/block/prd.c
index 62af81e..c4aeba7 100644
--- a/drivers/block/prd.c
+++ b/drivers/block/prd.c
@@ -218,13 +218,13 @@ static long prd_direct_access(struct block_device *bdev, sector_t sector,
 {
 	struct prd_device *prd = bdev->bd_disk->private_data;
 
-	if (!prd)
+	if (unlikely(!prd))
 		return -ENODEV;
 
 	*kaddr = prd_lookup_pg_addr(prd, sector);
 	*pfn = prd_lookup_pfn(prd, sector);
 
-	return size;
+	return min_t(long, size, prd->size);
This is off course a BUG need to subtract offset, will send version 2

Boaz
<>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help