For 3.0, I took the 2.6.29 copy of dm-cache.c out of git, manually fixed Kconfig and performed these changes to keep up with the kernel API as it is in 3.0:
*** dmpatch/dm-cache.c 2011-09-14 13:02:27.000000000 +0200
--- drivers/md/dm-cache.c 2011-08-11 14:22:56.000000000 +0200
***************
*** 41,47 ****
#include "dm.h"
#include <linux/dm-io.h>
! #include "dm-bio-list.h"
#include <linux/dm-kcopyd.h>
#define DMC_DEBUG 0
--- 41,47 ----
#include "dm.h"
#include <linux/dm-io.h>
! /*#include "dm-bio-list.h"*/
#include <linux/dm-kcopyd.h>
#define DMC_DEBUG 0
***************
*** 169,175 ****
struct cache_c *dmc = job->dmc;
struct dm_io_request iorq;
! iorq.bi_rw = (rw | (1 << BIO_RW_SYNCIO));
iorq.mem.type = DM_IO_BVEC;
iorq.mem.ptr.bvec = bvec;
iorq.notify.fn = fn;
--- 169,175 ----
struct cache_c *dmc = job->dmc;
struct dm_io_request iorq;
! iorq.bi_rw = (rw | REQ_SYNC);
iorq.mem.type = DM_IO_BVEC;
iorq.mem.ptr.bvec = bvec;
iorq.notify.fn = fn;
***************
*** 1477,1505 ****
goto bad;
}
! r = dm_get_device(ti, argv[0], 0, ti->len,
dm_table_get_mode(ti->table), &dmc->src_dev);
if (r) {
ti->error = "dm-cache: Source device lookup failed";
goto bad1;
}
! r = dm_get_device(ti, argv[1], 0, 0,
dm_table_get_mode(ti->table), &dmc->cache_dev);
if (r) {
ti->error = "dm-cache: Cache device lookup failed";
goto bad2;
}
! dmc->io_client = dm_io_client_create(DMCACHE_COPY_PAGES);
if (IS_ERR(dmc->io_client)) {
r = PTR_ERR(dmc->io_client);
ti->error = "Failed to create io client\n";
goto bad3;
}
! r = dm_kcopyd_client_create(DMCACHE_COPY_PAGES, &dmc->kcp_client);
! if (r) {
ti->error = "Failed to initialize kcopyd client\n";
goto bad4;
}
--- 1477,1505 ----
goto bad;
}
! r = dm_get_device(ti, argv[0],
dm_table_get_mode(ti->table), &dmc->src_dev);
if (r) {
ti->error = "dm-cache: Source device lookup failed";
goto bad1;
}
! r = dm_get_device(ti, argv[1],
dm_table_get_mode(ti->table), &dmc->cache_dev);
if (r) {
ti->error = "dm-cache: Cache device lookup failed";
goto bad2;
}
! dmc->io_client = dm_io_client_create();
if (IS_ERR(dmc->io_client)) {
r = PTR_ERR(dmc->io_client);
ti->error = "Failed to create io client\n";
goto bad3;
}
! dmc->kcp_client = dm_kcopyd_client_create();
! if (! dmc->kcp_client) {
ti->error = "Failed to initialize kcopyd client\n";
goto bad4;
}