/* * 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 */structraid_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 ------| */structdm_dev*meta_dev;structdm_dev*data_dev;structmd_rdevrdev;};/* * 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 0x400structraid_set{structdm_target*ti;uint32_tbitmap_loaded;uint32_tprint_flags;structmddevmd;structraid_type*raid_type;structdm_target_callbackscallbacks;structraid_devdev[0];};/* Supported raid types and properties. */staticstructraid_type{constchar*name;/* RAID algorithm. */constchar*descr;/* Descriptor text for logging. */constunsignedparity_devs;/* # of parity devices. */constunsigned