From: Jeff Dike If the file backing a ubd device is not an even blocklength, then the last partial block is now readable, and it is padded with zeros. Signed-off-by: Jeff Dike Signed-off-by: Andrew Morton --- 25-akpm/arch/um/drivers/ubd_kern.c | 4 ++++ 1 files changed, 4 insertions(+) diff -puN arch/um/drivers/ubd_kern.c~uml-allow-ubd-devices-to-provide-partial-end-blocks arch/um/drivers/ubd_kern.c --- 25/arch/um/drivers/ubd_kern.c~uml-allow-ubd-devices-to-provide-partial-end-blocks 2005-01-16 23:26:00.836645832 -0800 +++ 25-akpm/arch/um/drivers/ubd_kern.c 2005-01-16 23:26:00.841645072 -0800 @@ -687,6 +687,8 @@ static int ubd_new_disk(int major, u64 s return 0; } +#define ROUND_BLOCK(n) ((n + ((1 << 9) - 1)) & (-1 << 9)) + static int ubd_add(int n) { struct ubd *dev = &ubd_dev[n]; @@ -702,6 +704,8 @@ static int ubd_add(int n) if(err < 0) return(err); + dev->size = ROUND_BLOCK(dev->size); + err = ubd_new_disk(MAJOR_NR, dev->size, n, &ubd_gendisk[n]); if(err) return(err); _