···558558 goto bad4;559559 }560560561561- r = kcopyd_client_create(SNAPSHOT_PAGES, &s->kcopyd_client);561561+ r = dm_kcopyd_client_create(SNAPSHOT_PAGES, &s->kcopyd_client);562562 if (r) {563563 ti->error = "Could not create kcopyd client";564564 goto bad5;···591591 return 0;592592593593 bad6:594594- kcopyd_client_destroy(s->kcopyd_client);594594+ dm_kcopyd_client_destroy(s->kcopyd_client);595595596596 bad5:597597 s->store.destroy(&s->store);···613613614614static void __free_exceptions(struct dm_snapshot *s)615615{616616- kcopyd_client_destroy(s->kcopyd_client);616616+ dm_kcopyd_client_destroy(s->kcopyd_client);617617 s->kcopyd_client = NULL;618618619619 exit_exception_table(&s->pending, pending_cache);···839839 dest.count = src.count;840840841841 /* Hand over to kcopyd */842842- kcopyd_copy(s->kcopyd_client,842842+ dm_kcopyd_copy(s->kcopyd_client,843843 &src, 1, &dest, 0, copy_callback, pe);844844}845845
+1-1
drivers/md/dm-snap.h
···169169 /* The on disk metadata handler */170170 struct exception_store store;171171172172- struct kcopyd_client *kcopyd_client;172172+ struct dm_kcopyd_client *kcopyd_client;173173174174 /* Queue of snapshot writes for ksnapd to flush */175175 struct bio_list queued_bios;
+25-26
drivers/md/kcopyd.c
···99 * completion notification.1010 */11111212-#include <asm/types.h>1212+#include <linux/types.h>1313#include <asm/atomic.h>1414-1514#include <linux/blkdev.h>1615#include <linux/fs.h>1716#include <linux/init.h>···3839 * Each kcopyd client has its own little pool of preallocated3940 * pages for kcopyd io.4041 *---------------------------------------------------------------*/4141-struct kcopyd_client {4242+struct dm_kcopyd_client {4243 struct list_head list;43444445 spinlock_t lock;···7576 kfree(pl);7677}77787878-static int kcopyd_get_pages(struct kcopyd_client *kc,7979+static int kcopyd_get_pages(struct dm_kcopyd_client *kc,7980 unsigned int nr, struct page_list **pages)8081{8182 struct page_list *pl;···9899 return 0;99100}100101101101-static void kcopyd_put_pages(struct kcopyd_client *kc, struct page_list *pl)102102+static void kcopyd_put_pages(struct dm_kcopyd_client *kc, struct page_list *pl)102103{103104 struct page_list *cursor;104105···126127 }127128}128129129129-static int client_alloc_pages(struct kcopyd_client *kc, unsigned int nr)130130+static int client_alloc_pages(struct dm_kcopyd_client *kc, unsigned int nr)130131{131132 unsigned int i;132133 struct page_list *pl = NULL, *next;···147148 return 0;148149}149150150150-static void client_free_pages(struct kcopyd_client *kc)151151+static void client_free_pages(struct dm_kcopyd_client *kc)151152{152153 BUG_ON(kc->nr_free_pages != kc->nr_pages);153154 drop_pages(kc->pages);···161162 * ever having to do io (which could cause a deadlock).162163 *---------------------------------------------------------------*/163164struct kcopyd_job {164164- struct kcopyd_client *kc;165165+ struct dm_kcopyd_client *kc;165166 struct list_head list;166167 unsigned long flags;167168···181182 * The destinations for the transfer.182183 */183184 unsigned int num_dests;184184- struct dm_io_region dests[KCOPYD_MAX_REGIONS];185185+ struct dm_io_region dests[DM_KCOPYD_MAX_REGIONS];185186186187 sector_t offset;187188 unsigned int nr_pages;···191192 * Set this to ensure you are notified when the job has192193 * completed. 'context' is for callback to use.193194 */194194- kcopyd_notify_fn fn;195195+ dm_kcopyd_notify_fn fn;195196 void *context;196197197198 /*···294295 void *context = job->context;295296 int read_err = job->read_err;296297 unsigned long write_err = job->write_err;297297- kcopyd_notify_fn fn = job->fn;298298- struct kcopyd_client *kc = job->kc;298298+ dm_kcopyd_notify_fn fn = job->fn;299299+ struct dm_kcopyd_client *kc = job->kc;299300300301 kcopyd_put_pages(kc, job->pages);301302 mempool_free(job, _job_pool);···317318 else318319 job->read_err = 1;319320320320- if (!test_bit(KCOPYD_IGNORE_ERROR, &job->flags)) {321321+ if (!test_bit(DM_KCOPYD_IGNORE_ERROR, &job->flags)) {321322 push(&_complete_jobs, job);322323 wake();323324 return;···469470 * Only dispatch more work if there hasn't been an error.470471 */471472 if ((!job->read_err && !job->write_err) ||472472- test_bit(KCOPYD_IGNORE_ERROR, &job->flags)) {473473+ test_bit(DM_KCOPYD_IGNORE_ERROR, &job->flags)) {473474 /* get the next chunk of work */474475 progress = job->progress;475476 count = job->source.count - progress;···526527 segment_complete(0, 0u, job);527528}528529529529-int kcopyd_copy(struct kcopyd_client *kc, struct dm_io_region *from,530530- unsigned int num_dests, struct dm_io_region *dests,531531- unsigned int flags, kcopyd_notify_fn fn, void *context)530530+int dm_kcopyd_copy(struct dm_kcopyd_client *kc, struct dm_io_region *from,531531+ unsigned int num_dests, struct dm_io_region *dests,532532+ unsigned int flags, dm_kcopyd_notify_fn fn, void *context)532533{533534 struct kcopyd_job *job;534535···569570570571 return 0;571572}573573+EXPORT_SYMBOL(dm_kcopyd_copy);572574573575/*574576 * Cancels a kcopyd job, eg. someone might be deactivating a···589589static DEFINE_MUTEX(_client_lock);590590static LIST_HEAD(_clients);591591592592-static void client_add(struct kcopyd_client *kc)592592+static void client_add(struct dm_kcopyd_client *kc)593593{594594 mutex_lock(&_client_lock);595595 list_add(&kc->list, &_clients);596596 mutex_unlock(&_client_lock);597597}598598599599-static void client_del(struct kcopyd_client *kc)599599+static void client_del(struct dm_kcopyd_client *kc)600600{601601 mutex_lock(&_client_lock);602602 list_del(&kc->list);···650650 mutex_unlock(&kcopyd_init_lock);651651}652652653653-int kcopyd_client_create(unsigned int nr_pages, struct kcopyd_client **result)653653+int dm_kcopyd_client_create(unsigned int nr_pages,654654+ struct dm_kcopyd_client **result)654655{655656 int r = 0;656656- struct kcopyd_client *kc;657657+ struct dm_kcopyd_client *kc;657658658659 r = kcopyd_init();659660 if (r)···692691 *result = kc;693692 return 0;694693}694694+EXPORT_SYMBOL(dm_kcopyd_client_create);695695696696-void kcopyd_client_destroy(struct kcopyd_client *kc)696696+void dm_kcopyd_client_destroy(struct dm_kcopyd_client *kc)697697{698698 /* Wait for completion of all jobs submitted by this client. */699699 wait_event(kc->destroyq, !atomic_read(&kc->nr_jobs));···705703 kfree(kc);706704 kcopyd_exit();707705}708708-709709-EXPORT_SYMBOL(kcopyd_client_create);710710-EXPORT_SYMBOL(kcopyd_client_destroy);711711-EXPORT_SYMBOL(kcopyd_copy);706706+EXPORT_SYMBOL(dm_kcopyd_client_destroy);
+24-19
drivers/md/kcopyd.h
···11/*22- * Copyright (C) 2001 Sistina Software22+ * Copyright (C) 2001 - 2003 Sistina Software33+ * Copyright (C) 2004 - 2008 Red Hat, Inc. All rights reserved.44+ *55+ * kcopyd provides a simple interface for copying an area of one66+ * block-device to one or more other block-devices, either synchronous77+ * or with an asynchronous completion notification.38 *49 * This file is released under the GPL.55- *66- * Kcopyd provides a simple interface for copying an area of one77- * block-device to one or more other block-devices, with an asynchronous88- * completion notification.910 */10111111-#ifndef DM_KCOPYD_H1212-#define DM_KCOPYD_H1212+#ifndef _LINUX_DM_KCOPYD_H1313+#define _LINUX_DM_KCOPYD_H1414+1515+#ifdef __KERNEL__13161417#include "dm-io.h"15181619/* FIXME: make this configurable */1717-#define KCOPYD_MAX_REGIONS 82020+#define DM_KCOPYD_MAX_REGIONS 818211919-#define KCOPYD_IGNORE_ERROR 12222+#define DM_KCOPYD_IGNORE_ERROR 120232124/*2222- * To use kcopyd you must first create a kcopyd client object.2525+ * To use kcopyd you must first create a dm_kcopyd_client object.2326 */2424-struct kcopyd_client;2525-int kcopyd_client_create(unsigned int num_pages, struct kcopyd_client **result);2626-void kcopyd_client_destroy(struct kcopyd_client *kc);2727+struct dm_kcopyd_client;2828+int dm_kcopyd_client_create(unsigned num_pages,2929+ struct dm_kcopyd_client **result);3030+void dm_kcopyd_client_destroy(struct dm_kcopyd_client *kc);27312832/*2933 * Submit a copy job to kcopyd. This is built on top of the···3632 * read_err is a boolean,3733 * write_err is a bitset, with 1 bit for each destination region3834 */3939-typedef void (*kcopyd_notify_fn)(int read_err, unsigned long write_err,4040- void *context);3535+typedef void (*dm_kcopyd_notify_fn)(int read_err, unsigned long write_err,3636+ void *context);41374242-int kcopyd_copy(struct kcopyd_client *kc, struct dm_io_region *from,4343- unsigned num_dests, struct dm_io_region *dests,4444- unsigned int flags, kcopyd_notify_fn fn, void *context);3838+int dm_kcopyd_copy(struct dm_kcopyd_client *kc, struct dm_io_region *from,3939+ unsigned num_dests, struct dm_io_region *dests,4040+ unsigned flags, dm_kcopyd_notify_fn fn, void *context);45414646-#endif4242+#endif /* __KERNEL__ */4343+#endif /* _LINUX_DM_KCOPYD_H */