Re: [RFC] File backed target for device-mapper

From: Christophe Saout (christophe@saout.de)
Date: Tue Jul 22 2003 - 16:39:09 EST


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@saout.de>
Please avoid sending me Word or PowerPoint attachments.
See http://www.fsf.org/philosophy/no-word-attachments.html

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Jul 23 2003 - 22:00:48 EST