[dm-devel] Re: [RFC] File backed target for device-mapper
Christophe Saout
christophe at saout.de
Tue Jul 22 16:40:02 UTC 2003
Am Di, 2003-07-22 um 23.17 schrieb Christophe Saout:
> I just wrote a dm target uses a file as backend instead of another block
> device.
>
> It's heavily based on the linux 2.5 loop device (so it uses the inode
> operation sendfile for read operations and the address space operations
> prepare_write and commit_write for write operations).
Umm... lalala... (a cleanup and a *fix*) :D
--- dm-file.c.orig 2003-07-22 23:36:57.639746368 +0200
+++ dm-file.c 2003-07-22 23:37:26.203404032 +0200
@@ -87,17 +87,16 @@
{
char *src;
char *dst = (char *)desc->buf;
- unsigned long count = desc->count;
- if (size > count)
- size = count;
+ if (size > desc->count)
+ size = desc->count;
src = kmap(page) + offset;
if (src != dst) /* FIXME: is src == dst possible? */
memcpy(dst, src, size);
kunmap(page);
- desc->count = count - size;
+ desc->count -= size;
desc->written += size;
(char *)desc->buf += size;
@@ -127,8 +126,6 @@
if (r < 0)
break;
-
- pos += bv->bv_len;
}
return 0;
--
Christophe Saout <christophe at saout.de>
Please avoid sending me Word or PowerPoint attachments.
See http://www.fsf.org/philosophy/no-word-attachments.html
More information about the dm-devel
mailing list