inargv, auto_assem);
if (num_devs < 0)
return 1;
-
+
if (!st || !st->sb || !content)
return 2;
}
}
#endif
-
#include "mdadm.h"
-#define REGISTER_DEV _IO (MD_MAJOR, 1)
-#define START_MD _IO (MD_MAJOR, 2)
-#define STOP_MD _IO (MD_MAJOR, 3)
+#define REGISTER_DEV _IO (MD_MAJOR, 1)
+#define START_MD _IO (MD_MAJOR, 2)
+#define STOP_MD _IO (MD_MAJOR, 3)
int Build(char *mddev, struct mddev_dev *devlist,
struct shape *s, struct context *c)
struct mdinfo info;
struct mdinfo *sra;
-
if (ioctl(fd, GET_ARRAY_INFO, &array) < 0) {
pr_err("%s is not an active md array - aborting\n",
devname);
Manage_subdevs(devname, fd, devlist, verbose,
0,NULL, 0);
-
if (reshape.backup_blocks == 0 && data_offset)
reshape.backup_blocks = reshape.before.data_disks * info->array.chunk_size/512;
if (reshape.backup_blocks == 0) {
ifdef DISTRO_MAKEFILE
include $(DISTRO_MAKEFILE)
endif
-
#include "md_p.h"
#include <ctype.h>
-#define REGISTER_DEV _IO (MD_MAJOR, 1)
-#define START_MD _IO (MD_MAJOR, 2)
-#define STOP_MD _IO (MD_MAJOR, 3)
+#define REGISTER_DEV _IO (MD_MAJOR, 1)
+#define START_MD _IO (MD_MAJOR, 2)
+#define STOP_MD _IO (MD_MAJOR, 3)
int Manage_ro(char *devname, int fd, int readonly)
{
*/
close(tfd);
tfd = dev_open(dv->devname, O_RDONLY);
- }
+ }
if (tfd < 0) {
if (dv->disposition == 'M')
continue;
return rv;
}
- if (share)
+ if (share)
if (check_one_sharer(c->scan))
return 1;
}
}
-
while (! finished) {
int new_found = 0;
struct state *st;
if (check_array(st, mdstat, c->test, &info,
increments, c->prefer))
anydegraded = 1;
-
+
/* now check if there are any new devices found in mdstat */
if (c->scan)
new_found = add_new_arrays(mdstat, &statelist, c->test,
close(fd);
return 0;
}
-
+
err = st->ss->load_container(st, fd, NULL);
close(fd);
if (err)
return 0;
-
+
if (from == to) {
/* We must check if number of active disks has not increased
* since ioctl in main loop. mdmon may have added spare
return dev;
}
-
static void try_spare_migration(struct state *statelist, struct alert_info *info)
{
struct state *from;
/* subarray monitored without parent container
* we can't move spares here */
continue;
-
+
if (to->parent)
/* member of a container */
to = to->parent;
dl_free(line);
}
-
struct conf_dev {
struct conf_dev *next;
char *name;
if (strcasecmp(w, "<ignore>") == 0 ||
strncmp(w, "/dev/md/", 8) == 0 ||
(w[0] != '/' && w[0] != '<') ||
- (strncmp(w, "/dev/md", 7) == 0 &&
+ (strncmp(w, "/dev/md", 7) == 0 &&
is_number(w+7)) ||
(strncmp(w, "/dev/md_d", 9) == 0 &&
is_number(w+9))
}
}
-
static char *alert_program = NULL;
void programline(char *line)
{
else if (strncmp(match, "/dev/", 5) == 0)
match += 5;
-
if (strncmp(name, "md", 2) == 0 &&
isdigit(name[2]))
name += 2;
void *xcalloc(size_t num, size_t size);
#include "dlink.h"
-
void *dl_head()
{
void *h;
return NULL;
}
-
-
/*
* convert a major/minor pair for a block device into a name in /dev, if possible.
* On the first call, walk /dev collecting name.
return preferred ? preferred : regular;
}
-
-
/* conf_word gets one word from the conf file.
* if "allow_key", then accept words at the start of a line,
* otherwise stop when such a word is found.
struct supertype *container)
{
/* Of interest here are:
- * - if a new device has been added to the container, we
+ * - if a new device has been added to the container, we
* add it to the array ignoring any metadata on it.
* - if a device has been removed from the container, we
* remove it from the device list and update the metadata.
GET_LEVEL|GET_CHUNK|GET_DISKS|GET_COMPONENT|
GET_DEGRADED|GET_DEVS|GET_OFFSET|GET_SIZE|GET_STATE);
-
if (!mdi)
return;
new = xcalloc(1, sizeof(*new));
if (msg->len == 0) { /* ping_monitor */
int cnt;
-
+
cnt = monitor_loop_cnt;
if (cnt & 1)
cnt += 2; /* wait until next pselect */
#include <sys/file.h>
#include <ctype.h>
-
#define MAP_READ 0
#define MAP_NEW 1
#define MAP_LOCK 2
mapname[0]) == 0;
}
-
static FILE *lf = NULL;
int map_lock(struct map_ent **melp)
{
* It needs to match what -I or -As would come
* up with.
* That means:
- * Check if array is in mdadm.conf
+ * Check if array is in mdadm.conf
* - if so use that.
* determine trustworthy from homehost etc
* find a unique name based on metadata name.
- *
+ *
*/
struct mddev_ident *match = conf_match(st, info,
NULL, 0,
#include "mdadm.h"
-
/* name/number mappings */
mapping_t r5layout[] = {
{ NULL, 0}
};
-
mapping_t modes[] = {
{ "assemble", ASSEMBLE},
{ "build", BUILD},
}
return UnSet;
}
-
/*
* Constant generic information
*/
- __u32 md_magic; /* 0 MD identifier */
+ __u32 md_magic; /* 0 MD identifier */
__u32 major_version; /* 1 major version to which the set conforms */
__u32 minor_version; /* 2 minor version ... */
__u32 patch_version; /* 3 patchlevel version ... */
}
#endif
-
#include "md_p.h"
#include <ctype.h>
-
static int scan_assemble(struct supertype *ss,
struct context *c,
struct mddev_ident *ident);
char *dump_directory,
struct supertype *ss, struct context *c);
-
int main(int argc, char *argv[])
{
int mode = 0;
writemostly = 2;
continue;
-
case O(GROW,'z'):
case O(CREATE,'z'):
case O(BUILD,'z'): /* size */
if (a->devname &&
strcasecmp(a->devname, "<ignore>") == 0)
continue;
-
+
r = Assemble(ss, a->devname,
a, NULL, c);
if (r == 0) {
.SH SEE ALSO
.BR mdadm (8),
.BR md (4).
-
#define srandom srand
#endif
-
#include <linux/kdev_t.h>
/*#include <linux/fs.h> */
#include <sys/mount.h>
#endif
#endif /* __KLIBC__ */
-
/*
* min()/max()/clamp() macros that also do
* strict type-checking.. See the
int container_enough; /* flag external handlers can set to
* indicate that subarrays have not enough (-1),
* enough to start (0), or all expected disks (1) */
- char sys_name[20];
+ char sys_name[20];
struct mdinfo *devs;
struct mdinfo *next;
int num;
} mapping_t;
-
struct mdstat_ent {
char *dev;
char devnm[32];
struct dev_member {
char *name;
struct dev_member *next;
- } *members;
+ } *members;
struct mdstat_ent *next;
};
struct active_array;
struct metadata_update;
-
/* 'struct reshape' records the intermediate states of
* a general reshape.
* The starting geometry is converted to the 'before' geometry
* (in a->resync_start).
* resync status is really irrelevant if the array is not consistent,
* but some metadata (DDF!) have a place to record the distinction.
- * If 'consistent' is '2', then the array can mark it dirty if a
+ * If 'consistent' is '2', then the array can mark it dirty if a
* resync/recovery/whatever is required, or leave it clean if not.
* Return value is 0 dirty (not consistent) and 1 if clean.
* it is only really important if consistent is passed in as '2'.
extern int add_dev(const char *name, const struct stat *stb, int flag, struct FTW *s);
-
extern int Manage_ro(char *devname, int fd, int readonly);
extern int Manage_run(char *devname, int fd, int quiet);
extern int Manage_stop(char *devname, int fd, int quiet,
static inline int is_subarray(char *vers)
{
/* The version string for a 'subarray' (an array in a container)
- * is
+ * is
* /containername/componentname for normal read-write arrays
* -containername/componentname for arrays which mdmon must not
* reconfigure. They might be read-only
#define LEVEL_CONTAINER (-100)
#define LEVEL_UNSUPPORTED (-200)
-
/* faulty stuff */
#define WriteTransient 0
#define ModeMask 0x1f
#define ModeShift 5
-
#ifdef __TINYC__
#undef minor
#undef major
#define ALGORITHM_ROTATING_N_RESTART 9 /* DDF PRL=6 RLQ=2 */
#define ALGORITHM_ROTATING_N_CONTINUE 10 /*DDF PRL=6 RLQ=3 */
-
/* For every RAID5 algorithm we define a RAID6 algorithm
* with exactly the same layout for data and parity, and
* with the Q block always on the last device (N-1).
fcntl(sock, F_SETFL, fl);
n = read(sock, buf, 100);
/* Ignore result, it is just the wait that
- * matters
+ * matters
*/
}
enum sync_action { idle, reshape, resync, recover, check, repair, bad_action };
-
struct active_array {
struct mdinfo info;
struct supertype *container;
extern struct active_array *pending_discard;
extern struct md_generic_cmd *active_cmd;
-
void remove_pidfile(char *devname);
void do_monitor(struct supertype *container);
void do_manager(struct supertype *container);
return 1;
return 0;
}
-
) > init.cpio.gz
rm -rf initramfs
ls -l init.cpio.gz
-
-
/*
* Copyright (C) 2008 Intel Corporation
*
- * mdmon socket / message handling
+ * mdmon socket / message handling
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
return 0;
}
-
int send_message(int fd, struct metadata_update *msg, int tmo)
{
__s32 len = msg->len;
/*
* Copyright (C) 2008 Intel Corporation
*
- * mdmon socket / message handling
+ * mdmon socket / message handling
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
struct mdinfo;
struct metadata_update;
/* Structure definitions ext for MBR and GPT partition tables
*/
-
#define MBR_SIGNATURE_MAGIC __cpu_to_le16(0xAA55)
#define MBR_PARTITIONS 4
__u16 magic;
} __attribute__((packed));
-
-
#define GPT_SIGNATURE_MAGIC __cpu_to_le64(0x5452415020494645ULL)
#define MBR_GPT_PARTITION_TYPE 0xEE
#include <sys/stat.h>
#include <limits.h>
-
static int devpath_to_ll(const char *dev_path, const char *entry,
unsigned long long *val);
return head;
}
-
static struct sys_dev *intel_devices=NULL;
static time_t valid_time = 0;
return n;
}
-
static __u16 devpath_to_vendor(const char *dev_path)
{
char path[strlen(dev_path) + strlen("/vendor") + 1];
return 0;
}
-
const struct imsm_orom *imsm_platform_test(enum sys_dev_type hba_id, int *populated,
struct imsm_orom *imsm_orom)
{
return imsm_orom;
}
-
-
static const struct imsm_orom *find_imsm_hba_orom(enum sys_dev_type hba_id)
{
unsigned long align;
(c) & 0xff, ((c) >> 8) & 0xff, \
(d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
-
#define SYS_EFI_VAR_PATH "/sys/firmware/efi/vars"
#define SCU_PROP "RstScuV"
#define AHCI_PROP "RstSataV"
{
const struct imsm_orom *cap=NULL;
-
if ((cap = find_imsm_efi(hba_id)) != NULL)
return cap;
if ((cap = find_imsm_hba_orom(hba_id)) != NULL)
return !!(orom->sss & (1 << (fs - 1)));
}
-
/**
* fls - find last (most-significant) bit set
* @x: the word to search
char *devt_to_devpath(dev_t dev);
int path_attached_to_hba(const char *disk_path, const char *hba_path);
const char *get_sys_dev_type(enum sys_dev_type);
-
pol_dedup(*pol);
}
-
/*
* disk_policy() gathers policy information for the
* disk described in the given mdinfo (disk.{major,minor}).
return rv;
}
-
/* Domain policy:
* Any device can have a list of domains asserted by different policy
* statements.
domain_merge_one(domp, domain);
}
-
void domain_free(struct domainlist *dl)
{
while (dl) {
if (rc == 0)
rom_fd = fd;
else {
- if (fd >= 0)
+ if (fd >= 0)
close(fd);
probe_roms_exit();
}
};
static struct resource adapter_rom_resources[] = { {
- .name = "Adapter ROM",
+ .name = "Adapter ROM",
.start = 0xc8000,
.data = 0,
.end = 0,
}, {
- .name = "Adapter ROM",
+ .name = "Adapter ROM",
.start = 0,
.data = 0,
.end = 0,
}, {
- .name = "Adapter ROM",
+ .name = "Adapter ROM",
.start = 0,
.data = 0,
.end = 0,
}, {
- .name = "Adapter ROM",
+ .name = "Adapter ROM",
.start = 0,
.data = 0,
.end = 0,
}, {
- .name = "Adapter ROM",
+ .name = "Adapter ROM",
.start = 0,
.data = 0,
.end = 0,
}, {
- .name = "Adapter ROM",
+ .name = "Adapter ROM",
.start = 0,
.data = 0,
.end = 0,
} };
static struct resource video_rom_resource = {
- .name = "Video ROM",
+ .name = "Video ROM",
.start = 0xc0000,
.data = 0,
.end = 0xc7fff,
uint8_t **ptrs);
void xor_blocks(char *target, char **sources, int disks, int size);
-
/* Collect per stripe consistency information */
void raid6_collect(int chunk_size, uint8_t *p, uint8_t *q,
char *chunkP, char *chunkQ, int *results)
return rv * 256;
}
-
int check_stripes(struct mdinfo *info, int *source, unsigned long long *offsets,
int raid_disks, int chunk_size, int level, int layout,
unsigned long long start, unsigned long long length, char *name[],
}
write_res1 = write(source[failed_disk1], stripes[failed_disk1], chunk_size);
-
seek_res = lseek64(source[failed_disk2],
offsets[failed_disk2] + start * chunk_size, SEEK_SET);
if (seek_res < 0) {
}
}
-
length--;
start++;
}
case 500 + ALGORITHM_PARITY_0:
return block + 1;
-
case 600 + ALGORITHM_PARITY_N_6:
if (block == -2)
return raid_disks - 1;
return raid_disks - 1;
return block + 1;
-
case 600 + ALGORITHM_PARITY_0:
if (block == -1)
return 0;
if (block == -2) return (pd+1) % raid_disks;
return (pd + 2 + block) % raid_disks;
-
case 600 + ALGORITHM_ROTATING_N_RESTART:
/* Same a left_asymmetric, by first stripe is
* D D D P Q rather than
}
}
-
void xor_blocks(char *target, char **sources, int disks, int size)
{
int i, j;
}
}
-
/*
* The following was taken from linux/drivers/md/mktables.c, and modified
* to create in-memory tables rather than C code
if((Px != 0) && (Qx == 0))
curr_broken_disk = diskP;
-
if((Px == 0) && (Qx != 0))
curr_broken_disk = diskQ;
-
if((Px != 0) && (Qx != 0)) {
data_id = (raid6_gflog[Qx] - raid6_gflog[Px]);
if(data_id < 0) data_id += 255;
syndrome_disks = data_disks;
}
qsyndrome((uint8_t*)stripes[disk],
- (uint8_t*)stripes[qdisk],
+ (uint8_t*)stripes[qdisk],
(uint8_t**)blocks,
syndrome_disks, chunk_size);
break;
*p++ = '\0';
offsets[i] = atoll(p) * 512;
}
-
+
fds[i] = open(argv[9+i], O_RDWR);
if (fds[i] < 0) {
perror(argv[9+i]);
/*
* Copyright (C) 2007-2008 Intel Corporation
*
- * Retrieve drive serial numbers for scsi disks
+ * Retrieve drive serial numbers for scsi disks
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
64-byte boundary. (RFC 1321, 3.1: Step 1) */
static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ };
-
/* Take a pointer to a 160 bit block of data (five 32 bit ints) and
initialize it to the start constants of the SHA1 algorithm. This
must be called before using hash in the call to sha1_hash. */
sha1_uint32 buffer[32];
};
-
/* Initialize structure containing state of computation. */
extern void sha1_init_ctx (struct sha1_ctx *ctx);
aligned for a 32 bits value. */
extern void *sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf);
-
/* Put result from CTX in first 20 bytes following RESBUF. The result is
always in little endian byte order, so that a byte-wise output yields
to the wanted ASCII representation of the message digest.
aligned for a 32 bits value. */
extern void *sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf);
-
/* Compute SHA1 message digest for bytes read from STREAM. The
resulting message digest number will be written into the 20 bytes
beginning at RESBLOCK. */
free(super);
return 1;
}
-
+
if (super->magic != MBR_SIGNATURE_MAGIC ||
super->parts[0].part_type != MBR_GPT_PARTITION_TYPE) {
not_found:
#define CONFIGURED_DISK __cpu_to_le32(0x02) /* Member of some RaidDev */
#define FAILED_DISK __cpu_to_le32(0x04) /* Permanent failure */
__u32 status; /* 0xF0 - 0xF3 */
- __u32 owner_cfg_num; /* which config 0,1,2... owns this disk */
+ __u32 owner_cfg_num; /* which config 0,1,2... owns this disk */
__u32 total_blocks_hi; /* 0xF4 - 0xF5 total blocks hi */
#define IMSM_DISK_FILLERS 3
__u32 filler[IMSM_DISK_FILLERS]; /* 0xF5 - 0x107 MPB_DISK_FILLERS for future expansion */
struct bbm_log_entry mapped_block_entries[BBM_LOG_MAX_ENTRIES];
} __attribute__ ((__packed__));
-
#ifndef MDASSEMBLE
static char *map_state_str[] = { "normal", "uninitialized", "degraded", "failed" };
#endif
* MIGR_REC_BUF_SIZE <= MIGR_REC_POSITION
*/
-
#define UNIT_SRC_NORMAL 0 /* Source data for curr_migr_unit must
* be recovered using srcMap */
#define UNIT_SRC_IN_CP_AREA 1 /* Source data for curr_migr_unit has
enum imsm_update_type type;
};
-
static const char *_sys_dev_type[] = {
[SYS_DEV_UNKNOWN] = "Unknown",
[SYS_DEV_SAS] = "SAS",
return NULL;
}
-
static int find_intel_hba_capability(int fd, struct intel_super *super,
char *devname);
}
qsort(rv, memberships, sizeof(*rv), cmp_extent);
- /* determine the start of the metadata
+ /* determine the start of the metadata
* when no raid devices are defined use the default
* ...otherwise allow the metadata to truncate the value
* as is the case with older versions of imsm
/*******************************************************************************
* function: imsm_check_attributes
* Description: Function checks if features represented by attributes flags
- * are supported by mdadm.
+ * are supported by mdadm.
* Parameters:
* attributes - Attributes read from metadata
* Returns:
- * 0 - passed attributes contains unsupported features flags
- * 1 - all features are supported
+ * 0 - passed attributes contains unsupported features flags
+ * 1 - all features are supported
******************************************************************************/
static int imsm_check_attributes(__u32 attributes)
{
* not the device-set.
* uuid to recognise same set when adding a missing device back
* to an array. This is a uuid for the device-set.
- *
+ *
* For each of these we can make do with a truncated
* or hashed uuid rather than the original, as long as
* everyone agrees.
return update_memory_size;
}
-
static void imsm_update_metadata_locally(struct supertype *st,
void *buf, int len);
static int imsm_count_failed(struct intel_super *super, struct imsm_dev *dev,
int look_in_map);
-
#ifndef MDASSEMBLE
static void manage_second_map(struct intel_super *super, struct imsm_dev *dev)
{
info->array.level = LEVEL_CONTAINER;
info->array.layout = 0;
info->array.md_minor = -1;
- info->array.ctime = 0; /* N/A for imsm */
+ info->array.ctime = 0; /* N/A for imsm */
info->array.utime = 0;
info->array.chunk_size = 0;
}
-
/* if 'first' is a spare promote it to a populated mpb with sec's
* family number
*/
if (__le32_to_cpu(mpb->bbm_log_size)) {
ptr = mpb;
ptr += mpb->mpb_size - __le32_to_cpu(mpb->bbm_log_size);
- }
+ }
return ptr;
}
return champion;
}
-
static int
get_sra_super_block(int fd, struct intel_super **super_list, char *devname, int *max, int keep_fd);
static int get_super_block(struct intel_super **super_list, char *devnm, char *devname,
get_devlist_super_block(struct md_list *devlist, struct intel_super **super_list,
int *max, int keep_fd);
-
static int load_super_imsm_all(struct supertype *st, int fd, void **sbp,
char *devname, struct md_list *devlist,
int keep_fd)
free_imsm(s);
}
-
if (err)
return err;
return 0;
}
-
static int
get_devlist_super_block(struct md_list *devlist, struct intel_super **super_list,
int *max, int keep_fd)
return 0;
}
-
static int remove_from_super_imsm(struct supertype *st, mdu_disk_info_t *dk)
{
struct intel_super *super = st->sb;
dd->next = super->disk_mgmt_list;
super->disk_mgmt_list = dd;
-
return 0;
}
return 0;
}
-
static int create_array(struct supertype *st, int dev_idx)
{
size_t len;
return 0;
}
-
static int
active_arrays_by_format(char *name, char* hba, struct md_list **devlist,
int dpa, int verbose)
continue;
}
-
dv = xcalloc(1, sizeof(*dv));
dv->devname = xstrdup(buf);
dv->next = devlist;
return count;
}
-
static int
count_volumes(char *hba, int dpa, int verbose)
{
return 1;
}
-/* validate_geometry_imsm_volume - lifted from validate_geometry_ddf_bvd
+/* validate_geometry_imsm_volume - lifted from validate_geometry_ddf_bvd
* FIX ME add ahci details
*/
static int validate_geometry_imsm_volume(struct supertype *st, int level,
sb_errors = 1;
}
-
/* count spare devices, not used in maps
*/
for (d = super->disks; d; d = d->next)
if (ord & IMSM_ORD_REBUILD)
recovery_start = 0;
- /*
+ /*
* if we skip some disks the array will be assmebled degraded;
* reset resync start to avoid a dirty-degraded
* situation when performing the intial sync
return rest;
}
-
static __u8 imsm_check_degraded(struct intel_super *super, struct imsm_dev *dev,
int failed, int look_in_map)
{
map = get_imsm_map(dev, look_in_map);
if (!failed)
- return map->map_state == IMSM_T_STATE_UNINITIALIZED ?
+ return map->map_state == IMSM_T_STATE_UNINITIALIZED ?
IMSM_T_STATE_UNINITIALIZED : IMSM_T_STATE_NORMAL;
switch (get_imsm_raid_level(map)) {
struct imsm_disk *disk;
/* reset the potential in-sync count on even-numbered
- * slots. num_copies is always 2 for imsm raid10
+ * slots. num_copies is always 2 for imsm raid10
*/
if ((i & 1) == 0)
insync = 2;
return dl;
}
-
static int imsm_rebuild_allowed(struct supertype *cont, int dev_idx, int failed)
{
struct imsm_dev *dev2;
dl = imsm_add_spare(super, i, a, 1, rv);
if (!dl)
continue;
-
+
/* found a usable disk with enough space */
di = xcalloc(1, sizeof(*di));
* disk_ord_tbl for the array
*/
mu = xmalloc(sizeof(*mu));
- mu->buf = xcalloc(num_spares,
+ mu->buf = xcalloc(num_spares,
sizeof(struct imsm_update_activate_spare));
mu->space = NULL;
mu->space_list = NULL;
return 0;
}
-
static struct dl *get_disk_super(struct intel_super *super, int major, int minor)
{
struct dl *dl = NULL;
return check_degraded;
}
-
static int apply_reshape_migration_update(struct imsm_update_reshape_migration *u,
struct intel_super *super,
void ***space_list)
return ret_val;
}
-
static int apply_update_activate_spare(struct imsm_update_activate_spare *u,
struct intel_super *super,
struct active_array *active_array)
* the arrays for general migration and convert selected spares
* into active devices.
* update_activate_spare - a spare device has replaced a failed
- * device in an array, update the disk_ord_tbl. If this disk is
- * present in all member arrays then also clear the SPARE_DISK
- * flag
+ * device in an array, update the disk_ord_tbl. If this disk is
+ * present in all member arrays then also clear the SPARE_DISK
+ * flag
* update_create_array
* update_kill_array
* update_rename_array
break;
}
case update_activate_spare: {
- struct imsm_update_activate_spare *u = (void *) update->buf;
+ struct imsm_update_activate_spare *u = (void *) update->buf;
if (apply_update_activate_spare(u, super, st->arrays))
super->updates_pending++;
break;
}
}
-
/*******************************************************************************
* Function: open_backup_targets
* Description: Function opens file descriptors for all devices given in
migr_rec->post_migr_vol_cap = dev->size_low;
migr_rec->post_migr_vol_cap_hi = dev->size_high;
-
/* Find the smallest dev */
for (sd = info->devs ; sd ; sd = sd->next) {
sprintf(nm, "%d:%d", sd->disk.major, sd->disk.minor);
drv = "isci";
else if (hba && hba->type == SYS_DEV_SATA)
drv = "ahci";
- else
+ else
drv = "unknown";
dprintf("path: %s hba: %s attached: %s\n",
path, (hba) ? hba->path : "NULL", drv);
/* Function: get_spares_for_grow
* Description: Allocates memory and creates list of spare devices
- * avaliable in container. Checks if spare drive size is acceptable.
+ * avaliable in container. Checks if spare drive size is acceptable.
* Parameters: Pointer to the supertype structure
* Returns: Pointer to the list of spare devices (mdinfo structure) on success,
- * NULL if fail
+ * NULL if fail
*/
static struct mdinfo *get_spares_for_grow(struct supertype *st)
{
return 0;
}
-
/******************************************************************************
* function: imsm_create_metadata_update_for_size_change()
* Creates update for IMSM array for array size change.
/***************************************************************************
* Function: imsm_analyze_change
* Description: Function analyze change for single volume
-* and validate if transition is supported
+* and validate if transition is supported
* Parameters: Geometry parameters, supertype structure,
* metadata change direction (apply/rollback)
* Returns: Operation type code on success, -1 if fail
dprintf("imsm: info: Volume operation\n");
/* find requested device */
while (dev) {
- char *devnm =
+ char *devnm =
imsm_find_array_devnm_by_subdev(
dev->index, st->container_devnm);
if (devnm && strcmp(devnm, geo.devnm) == 0)
.match_metadata_desc = match_metadata_desc_imsm,
.container_content = container_content_imsm,
-
.external = 1,
.name = "imsm",
free(super);
return 1;
}
-
+
if (super->magic != MBR_SIGNATURE_MAGIC) {
if (devname)
pr_err("No partition table found on %s\n",
for (i = 0; i < MBR_PARTITIONS ; i++)
if (sb->parts[i].blocks_num) {
- unsigned long last =
+ unsigned long last =
(unsigned long)__le32_to_cpu(sb->parts[i].blocks_num)
+ (unsigned long)__le32_to_cpu(sb->parts[i].first_sect_lba);
if (last > info->component_size)
* .. other stuff
*/
-
static unsigned long calc_sb0_csum(mdp_super_t *super)
{
unsigned long csum = super->sb_csum;
* host name
*/
-
static int init_super0(struct supertype *st, mdu_array_info_t *info,
unsigned long long size, char *ignored_name, char *homehost,
int *uuid, unsigned long long data_offset)
if (super->state & (1<<MD_SB_BITMAP_PRESENT)) {
struct bitmap_super_s * bm = (struct bitmap_super_s*)(super+1);
if (__le32_to_cpu(bm->magic) == BITMAP_MAGIC)
- if (write(fd, bm, ROUND_UP(sizeof(*bm),4096)) !=
+ if (write(fd, bm, ROUND_UP(sizeof(*bm),4096)) !=
ROUND_UP(sizeof(*bm),4096))
return 5;
}
return 1;
if (!first) {
if (posix_memalign((void**)&first, 4096,
- MD_SB_BYTES +
+ MD_SB_BYTES +
ROUND_UP(sizeof(struct bitmap_super_s), 4096)) != 0) {
pr_err("%s could not allocate superblock\n", __func__);
return 1;
return 0;
}
-
static void free_super0(struct supertype *st);
static int load_super0(struct supertype *st, int fd, char *devname)
bitmap_super_t *bms = (bitmap_super_t*)(((char*)sb) + MD_SB_BYTES);
int uuid[4];
-
min_chunk = 4096; /* sub-page chunks don't work yet.. */
bits = (size * 512) / min_chunk + 1;
while (bits > max_bits) {
return 1;
}
-
static void locate_bitmap0(struct supertype *st, int fd)
{
unsigned long long dsize;
printf("\n");
}
-
if (calc_sb_1_csum(sb) == sb->sb_csum)
printf(" Checksum : %x - correct\n", __le32_to_cpu(sb->sb_csum));
else
printf("\n");
}
-
static void brief_examine_super1(struct supertype *st, int verbose)
{
struct mdp_superblock_1 *sb = st->sb;
info->disk.state |= 1 << MD_DISK_REPLACEMENT;
}
-
if (sb->feature_map & __le32_to_cpu(MD_FEATURE_RECOVERY_OFFSET))
info->recovery_start = __le32_to_cpu(sb->recovery_offset);
else
return -EINVAL;
}
-
-
if (sb_offset != __le64_to_cpu(sb->super_offset) &&
0 != __le64_to_cpu(sb->super_offset)
) {
sb->events = 0;
refst = dup_super(st);
- if (load_super1(refst, di->fd, NULL)==0) {
+ if (load_super1(refst, di->fd, NULL)==0) {
struct mdp_superblock_1 *refsb = refst->sb;
memcpy(sb->device_uuid, refsb->device_uuid, 16);
goto error_out;
}
-
/*
* Calculate the position of the superblock.
* It is always aligned to a 4K boundary and
return 0;
}
-
static struct supertype *match_metadata_desc1(char *arg)
{
struct supertype *st = xcalloc(1, sizeof(*st));
else
devsize -= 8;
-
if (st->minor_version < 0)
/* not specified, so time to set default */
st->minor_version = 2;
bitmap_super_t *bms = (bitmap_super_t*)(((char*)sb) + MAX_SB_SIZE);
int uuid[4];
-
if (__le64_to_cpu(sb->data_size) == 0)
/* Must be creating the array, else data_size would be non-zero */
creating = 1;
exit(1);
}
-
for (i=0; i < 4096 ; i+=4) {
char t = super[i];
super[i] = super[i+3];
super[32*4+10*4 +i] = t;
}
-
if (lseek64(fd, offset, 0) < 0LL) {
perror("lseek64");
exit(1);
exit(0);
}
-
-
strcpy(mdi->sys_name, devnm);
}
-
struct mdinfo *sysfs_read(int fd, char *devnm, unsigned long options)
{
char fname[PATH_MAX];
return -1;
}
return 0;
-}
+}
int sysfs_attribute_available(struct mdinfo *sra, struct mdinfo *dev, char *name)
{
return 0;
}
-
int sysfs_unique_holder(char *devnm, long rdev)
{
/* Check that devnm is a holder of rdev,
check linear
testdev $md0 5 $size 64
mdadm -S $md0
-
done
mdadm -S $md0
done
-
done
mdadm -S $md0
done
-
mdadm -A $md0 --name="Fred" $devlist
#mdadm -Db $md0
mdadm -S $md0
-
mdadm -CR $md0 -l1 -n3 --write-behind --bitmap=internal --bitmap-chunk=4 $dev0 $dev1 --write-mostly $dev2
testdev $md0 1 $mdsize1a 64
mdadm -S $md0
-
mdadm --add $container $dev4
check wait
imsm_check_hold $container $dev4
-
vol0_new_chunk=64
. tests/imsm-grow-template 1 1
-
vol0_new_num_comps=$vol0_num_comps
vol0_new_chunk=256
-
. tests/imsm-grow-template 0 1
-
-
echo "ERROR: size is wrong for $dev: $cnt * $size (chunk=$chunk) = $rasize, not `/sbin/blockdev --getsize $dev`"
exit 1;
fi
-
return data_disks;
}
-
int devnm2devid(char *devnm)
{
/* First look in /sys/block/$DEVNM/dev for %d:%d