On 08/13/2014 03:16 PM, Boaz Harrosh wrote: > From: Boaz Harrosh <boaz@xxxxxxxxxxxxx> > > 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 <boaz@xxxxxxxxxxxxx> > --- > 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@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>