/* * Copyright (C) 2010-2011 Neil Brown * Copyright (C) 2010-2011 Red Hat, Inc. All rights reserved. * * This file is released under the GPL. */#include <linux/slab.h>#include <linux/module.h>#include"md.h"#include"raid1.h"#include"raid5.h"#include"raid10.h"#include"bitmap.h"#include <linux/device-mapper.h>#define DM_MSG_PREFIX"raid"/* * The following flags are used by dm-raid.c to set up the array state. * They must be cleared before md_run is called. */#define FirstUse 10/* rdev flag */struct raid_dev {/* * Two DM devices, one to hold metadata and one to hold the * actual data/parity. The reason for this is to not confuse * ti->len and give more flexibility in altering size and * characteristics. * * While it is possible for this device to be associated * with a different physical device than the data_dev, it * is intended for it to be the same. * |--------- Physical Device ---------| * |- meta_dev -|------ data_dev ------| */struct dm_dev *meta_dev;struct dm_dev *data_dev;struct md_rdev rdev;};/* * Flags for rs->print_flags field. */#define DMPF_SYNC 0x1#define DMPF_NOSYNC 0x2#define DMPF_REBUILD 0x4#define DMPF_DAEMON_SLEEP 0x8#define DMPF_MIN_RECOVERY_RATE 0x10#define DMPF_MAX_RECOVERY_RATE 0x20#define DMPF_MAX_WRITE_BEHIND 0x40#define DMPF_STRIPE_CACHE 0x80#define DMPF_REGION_SIZE 0x100#define DMPF_RAID10_COPIES 0x200#define DMPF_RAID10_FORMAT 0x400struct raid_set {struct dm_target *ti;uint32_t bitmap_loaded;uint32_t print_flags;struct mddev md;struct raid_type *raid_type;struct dm_target_callbacks callbacks;struct raid_dev dev[0];};/* Supported raid types and properties. */static struct raid_type {const char*name;/* RAID algorithm. */