2001-06-08 04:36:23 +02:00
|
|
|
#
|
2002-03-08 01:03:52 +01:00
|
|
|
# mdadm - manage Linux "md" devices aka RAID arrays.
|
2001-06-08 04:36:23 +02:00
|
|
|
#
|
2002-03-07 00:17:40 +01:00
|
|
|
# Copyright (C) 2001-2002 Neil Brown <neilb@cse.unsw.edu.au>
|
2013-06-19 02:02:17 +02:00
|
|
|
# Copyright (C) 2013 Neil Brown <neilb@suse.de>
|
2001-06-08 04:36:23 +02:00
|
|
|
#
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
#
|
|
|
|
# Author: Neil Brown
|
|
|
|
# Email: <neilb@cse.unsw.edu.au>
|
|
|
|
# Paper: Neil Brown
|
|
|
|
# School of Computer Science and Engineering
|
|
|
|
# The University of New South Wales
|
|
|
|
# Sydney, 2052
|
|
|
|
# Australia
|
|
|
|
#
|
|
|
|
|
2002-05-10 06:06:19 +02:00
|
|
|
# define "CXFLAGS" to give extra flags to CC.
|
|
|
|
# e.g. make CXFLAGS=-O to optimise
|
2003-02-12 01:17:26 +01:00
|
|
|
TCC = tcc
|
2004-08-11 04:16:01 +02:00
|
|
|
UCLIBC_GCC = $(shell for nm in i386-uclibc-linux-gcc i386-uclibc-gcc; do which $$nm > /dev/null && { echo $$nm ; exit; } ; done; echo false No uclibc found )
|
2008-09-18 06:33:37 +02:00
|
|
|
#DIET_GCC = diet gcc
|
2013-06-19 02:02:17 +02:00
|
|
|
# sorry, but diet-libc doesn't know about posix_memalign,
|
2008-09-18 06:33:37 +02:00
|
|
|
# so we cannot use it any more.
|
|
|
|
DIET_GCC = gcc -DHAVE_STDINT_H
|
2004-11-01 05:49:34 +01:00
|
|
|
|
|
|
|
KLIBC=/home/src/klibc/klibc-0.77
|
|
|
|
|
|
|
|
KLIBC_GCC = gcc -nostdinc -iwithprefix include -I$(KLIBC)/klibc/include -I$(KLIBC)/linux/include -I$(KLIBC)/klibc/arch/i386/include -I$(KLIBC)/klibc/include/bits32
|
2003-02-12 01:17:26 +01:00
|
|
|
|
2016-02-08 10:59:29 +01:00
|
|
|
CC ?= $(CROSS_COMPILE)gcc
|
2013-06-24 08:59:37 +02:00
|
|
|
CXFLAGS ?= -ggdb
|
2010-08-05 05:13:02 +02:00
|
|
|
CWFLAGS = -Wall -Werror -Wstrict-prototypes -Wextra -Wno-unused-parameter
|
2008-09-28 21:12:07 +02:00
|
|
|
ifdef WARN_UNUSED
|
2013-06-19 02:02:17 +02:00
|
|
|
CWFLAGS += -Wp,-D_FORTIFY_SOURCE=2 -O3
|
2008-09-28 21:12:07 +02:00
|
|
|
endif
|
2006-05-15 08:02:41 +02:00
|
|
|
|
2017-03-17 12:55:42 +01:00
|
|
|
FALLTHROUGH := $(shell gcc -v --help 2>&1 | grep "implicit-fallthrough" | wc -l)
|
|
|
|
ifneq "$(FALLTHROUGH)" "0"
|
|
|
|
CWFLAGS += -Wimplicit-fallthrough=0
|
|
|
|
endif
|
|
|
|
|
2006-05-15 08:02:41 +02:00
|
|
|
ifdef DEBIAN
|
2012-08-12 21:24:15 +02:00
|
|
|
CPPFLAGS += -DDEBIAN
|
2010-05-28 14:12:41 +02:00
|
|
|
endif
|
|
|
|
ifdef DEFAULT_OLD_METADATA
|
2012-08-12 21:24:15 +02:00
|
|
|
CPPFLAGS += -DDEFAULT_OLD_METADATA
|
2010-05-28 14:12:41 +02:00
|
|
|
DEFAULT_METADATA=0.90
|
|
|
|
else
|
|
|
|
DEFAULT_METADATA=1.2
|
2006-05-15 08:02:41 +02:00
|
|
|
endif
|
2014-05-22 09:13:02 +02:00
|
|
|
CPPFLAGS += -DBINDIR=\"$(BINDIR)\"
|
2006-05-15 08:02:41 +02:00
|
|
|
|
2012-08-13 19:44:22 +02:00
|
|
|
PKG_CONFIG ?= pkg-config
|
|
|
|
|
2002-03-20 23:39:50 +01:00
|
|
|
SYSCONFDIR = /etc
|
|
|
|
CONFFILE = $(SYSCONFDIR)/mdadm.conf
|
2006-06-02 12:53:02 +02:00
|
|
|
CONFFILE2 = $(SYSCONFDIR)/mdadm/mdadm.conf
|
2003-07-29 01:59:00 +02:00
|
|
|
MAILCMD =/usr/sbin/sendmail -t
|
2006-06-02 12:53:02 +02:00
|
|
|
CONFFILEFLAGS = -DCONFFILE=\"$(CONFFILE)\" -DCONFFILE2=\"$(CONFFILE2)\"
|
2010-07-20 18:15:37 +02:00
|
|
|
# Both MAP_DIR and MDMON_DIR should be somewhere that persists across the
|
|
|
|
# pivotroot from early boot to late boot.
|
2013-08-05 08:39:45 +02:00
|
|
|
# /run is best, but for distros that don't support that.
|
|
|
|
# /dev can work, in which case you probably want /dev/.mdadm
|
|
|
|
RUN_DIR=/run/mdadm
|
|
|
|
CHECK_RUN_DIR=1
|
|
|
|
MAP_DIR=$(RUN_DIR)
|
2010-07-20 18:15:37 +02:00
|
|
|
MAP_FILE = map
|
2012-05-03 06:16:56 +02:00
|
|
|
MAP_PATH = $(MAP_DIR)/$(MAP_FILE)
|
2013-08-05 08:39:45 +02:00
|
|
|
MDMON_DIR = $(RUN_DIR)
|
2010-11-22 10:58:06 +01:00
|
|
|
# place for autoreplace cookies
|
2013-08-05 08:39:45 +02:00
|
|
|
FAILED_SLOTS_DIR = $(RUN_DIR)/failed-slots
|
2013-02-01 16:15:18 +01:00
|
|
|
SYSTEMD_DIR=/lib/systemd/system
|
2015-06-10 07:42:06 +02:00
|
|
|
|
|
|
|
COROSYNC:=$(shell [ -d /usr/include/corosync ] || echo -DNO_COROSYNC)
|
2015-10-19 10:03:19 +02:00
|
|
|
DLM:=$(shell [ -f /usr/include/libdlm.h ] || echo -DNO_DLM)
|
2015-06-10 07:42:06 +02:00
|
|
|
|
2010-07-20 18:15:37 +02:00
|
|
|
DIRFLAGS = -DMAP_DIR=\"$(MAP_DIR)\" -DMAP_FILE=\"$(MAP_FILE)\"
|
|
|
|
DIRFLAGS += -DMDMON_DIR=\"$(MDMON_DIR)\"
|
2010-11-22 10:58:06 +01:00
|
|
|
DIRFLAGS += -DFAILED_SLOTS_DIR=\"$(FAILED_SLOTS_DIR)\"
|
2015-10-19 10:03:19 +02:00
|
|
|
CFLAGS = $(CWFLAGS) $(CXFLAGS) -DSendmail=\""$(MAILCMD)"\" $(CONFFILEFLAGS) $(DIRFLAGS) $(COROSYNC) $(DLM)
|
2002-03-20 23:39:50 +01:00
|
|
|
|
2013-06-25 08:27:05 +02:00
|
|
|
VERSION = $(shell [ -d .git ] && git describe HEAD | sed 's/mdadm-//')
|
2017-01-11 00:51:40 +01:00
|
|
|
VERS_DATE = $(shell [ -d .git ] && date --iso-8601 --date="`git log -n1 --format=format:%cd --date=iso --date=short`")
|
2013-06-25 08:27:05 +02:00
|
|
|
DVERS = $(if $(VERSION),-DVERSION=\"$(VERSION)\",)
|
|
|
|
DDATE = $(if $(VERS_DATE),-DVERS_DATE="\"$(VERS_DATE)\"",)
|
|
|
|
CFLAGS += $(DVERS) $(DDATE)
|
|
|
|
|
2010-07-06 21:48:56 +02:00
|
|
|
# The glibc TLS ABI requires applications that call clone(2) to set up
|
|
|
|
# TLS data structures, use pthreads until mdmon implements this support
|
|
|
|
USE_PTHREADS = 1
|
|
|
|
ifdef USE_PTHREADS
|
|
|
|
CFLAGS += -DUSE_PTHREADS
|
2010-08-06 12:11:43 +02:00
|
|
|
MON_LDFLAGS += -pthread
|
2010-07-06 21:48:56 +02:00
|
|
|
endif
|
|
|
|
|
2002-03-20 23:39:50 +01:00
|
|
|
# If you want a static binary, you might uncomment these
|
|
|
|
# LDFLAGS = -static
|
|
|
|
# STRIP = -s
|
2015-06-10 07:42:06 +02:00
|
|
|
LDLIBS=-ldl
|
2001-06-08 04:36:23 +02:00
|
|
|
|
2002-03-07 00:17:40 +01:00
|
|
|
INSTALL = /usr/bin/install
|
2013-06-19 02:02:17 +02:00
|
|
|
DESTDIR =
|
2002-03-08 01:03:52 +01:00
|
|
|
BINDIR = /sbin
|
2002-04-06 00:00:28 +02:00
|
|
|
MANDIR = /usr/share/man
|
|
|
|
MAN4DIR = $(MANDIR)/man4
|
|
|
|
MAN5DIR = $(MANDIR)/man5
|
|
|
|
MAN8DIR = $(MANDIR)/man8
|
2002-03-07 00:17:40 +01:00
|
|
|
|
2012-08-13 19:44:22 +02:00
|
|
|
UDEVDIR := $(shell $(PKG_CONFIG) --variable=udevdir udev 2>/dev/null)
|
|
|
|
ifndef UDEVDIR
|
|
|
|
UDEVDIR = /lib/udev
|
|
|
|
endif
|
|
|
|
|
2015-08-05 07:10:43 +02:00
|
|
|
ifeq (,$(findstring s,$(MAKEFLAGS)))
|
|
|
|
ECHO=echo
|
|
|
|
else
|
|
|
|
ECHO=:
|
|
|
|
endif
|
|
|
|
|
2011-04-05 00:44:54 +02:00
|
|
|
OBJS = mdadm.o config.o policy.o mdstat.o ReadMe.o util.o maps.o lib.o \
|
2011-04-05 00:40:49 +02:00
|
|
|
Manage.o Assemble.o Build.o \
|
2005-06-08 01:16:35 +02:00
|
|
|
Create.o Detail.o Examine.o Grow.o Monitor.o dlink.o Kill.o Query.o \
|
2013-05-16 07:07:16 +02:00
|
|
|
Incremental.o Dump.o \
|
2008-05-15 08:48:22 +02:00
|
|
|
mdopen.o super0.o super1.o super-ddf.o super-intel.o bitmap.o \
|
2010-08-20 05:10:50 +02:00
|
|
|
super-mbr.o super-gpt.o \
|
2012-07-16 23:56:54 +02:00
|
|
|
restripe.o sysfs.o sha1.o mapfile.o crc32.o sg_io.o msg.o xmalloc.o \
|
2015-10-28 20:06:06 +01:00
|
|
|
platform-intel.o probe_roms.o crc32c.o
|
2008-12-09 00:59:18 +01:00
|
|
|
|
2013-07-02 08:06:55 +02:00
|
|
|
CHECK_OBJS = restripe.o sysfs.o maps.o lib.o xmalloc.o dlink.o
|
RAID-6 check standalone
Hi Neil,
please find attached a patch, to mdadm-3.2 base, including
a standalone versione of the raid-6 check.
This is basically a re-working (and hopefully improvement)
of the already implemented check in "restripe.c".
I splitted the check function into "collect" and "stats",
so that the second one could be easily replaced.
The API is also simplified.
The command line option are reduced, since we only level
is raid-6, but the ":offset" option is included.
The output reports the block/stripe rotation, P/Q errors
and the possible HDD (or unknown).
BTW, the patch applies also to the already patched "restripe.c",
including the last ":offset" patch (which is not yet in git).
Other item is that due to "sysfs.c" linking (see below) the
"Makefile" needed some changes, I hope this is not a problem.
Next steps (TODO list you like) would be:
1) Add the "sysfs.c" code in order to retrieve the HDDs info
from the MD device. It is already linked, together with the
whole (mdadm) universe, since it seems it cannot leave alone.
I'll need some advice or hint on how to do use it. I checked
"sysfs.c", but before I dig deep into it maybe better to
have some advice (maybe just one function call will do it).
2) Add the suspend lo/hi control. Fellow John Robinson was
suggesting to look into "Grow.c", which I did, but I guess
the same story as 1) is valid: better to have some hint on
where to look before wasting time.
3) Add a repair option (future). This should have different
levels, like "all", "disk", "stripe". That is, fix everything
(more or less like "repair"), fix only if a disk is clearly
having problems, fix each stripe which has clearly a problem
(but maybe different stripes may belong to different HDDs).
So, for the point 1) and 2) would be nice to have some more
detail on where to look what. Point 3) we will discuss later.
Thanks, please consider for inclusion,
bye,
pg
Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-21 03:52:44 +01:00
|
|
|
|
2011-04-05 00:40:49 +02:00
|
|
|
SRCS = $(patsubst %.o,%.c,$(OBJS))
|
2005-05-04 01:44:18 +02:00
|
|
|
|
2010-08-19 08:48:34 +02:00
|
|
|
INCL = mdadm.h part.h bitmap.h
|
|
|
|
|
2011-04-05 00:40:49 +02:00
|
|
|
MON_OBJS = mdmon.o monitor.o managemon.o util.o maps.o mdstat.o sysfs.o \
|
2013-07-02 02:24:50 +02:00
|
|
|
policy.o lib.o \
|
2014-08-07 04:14:49 +02:00
|
|
|
Kill.o sg_io.o dlink.o ReadMe.o super-intel.o \
|
2010-08-20 05:10:50 +02:00
|
|
|
super-mbr.o super-gpt.o \
|
2012-07-16 23:56:54 +02:00
|
|
|
super-ddf.o sha1.o crc32.o msg.o bitmap.o xmalloc.o \
|
2017-03-29 11:54:17 +02:00
|
|
|
platform-intel.o probe_roms.o crc32c.o
|
2008-05-15 08:48:37 +02:00
|
|
|
|
2011-04-05 00:40:49 +02:00
|
|
|
MON_SRCS = $(patsubst %.o,%.c,$(MON_OBJS))
|
2008-05-15 08:48:37 +02:00
|
|
|
|
2006-06-02 08:12:19 +02:00
|
|
|
STATICSRC = pwgr.c
|
|
|
|
STATICOBJS = pwgr.o
|
2006-05-29 04:18:22 +02:00
|
|
|
|
2010-07-05 02:11:21 +02:00
|
|
|
ASSEMBLE_SRCS := mdassemble.c Assemble.c Manage.c config.c policy.c dlink.c util.c \
|
2012-07-16 23:56:54 +02:00
|
|
|
maps.c lib.c xmalloc.c \
|
2008-12-09 00:59:18 +01:00
|
|
|
super0.c super1.c super-ddf.c super-intel.c sha1.c crc32.c sg_io.c mdstat.c \
|
2017-03-29 11:54:17 +02:00
|
|
|
platform-intel.c probe_roms.c sysfs.c super-mbr.c super-gpt.c mapfile.c \
|
|
|
|
crc32c.c
|
2009-03-10 06:47:02 +01:00
|
|
|
ASSEMBLE_AUTO_SRCS := mdopen.c
|
2006-05-29 04:06:32 +02:00
|
|
|
ASSEMBLE_FLAGS:= $(CFLAGS) -DMDASSEMBLE
|
2004-11-01 05:49:34 +01:00
|
|
|
ifdef MDASSEMBLE_AUTO
|
2008-05-19 04:07:47 +02:00
|
|
|
ASSEMBLE_SRCS += $(ASSEMBLE_AUTO_SRCS)
|
2005-06-14 08:49:05 +02:00
|
|
|
ASSEMBLE_FLAGS += -DMDASSEMBLE_AUTO
|
2004-11-01 05:49:34 +01:00
|
|
|
endif
|
2002-03-07 00:17:40 +01:00
|
|
|
|
2014-11-25 01:44:18 +01:00
|
|
|
all : mdadm mdmon
|
2011-08-09 02:43:58 +02:00
|
|
|
man : mdadm.man md.man mdadm.conf.man mdmon.man raid6check.man
|
2001-06-08 04:36:23 +02:00
|
|
|
|
2013-08-05 08:39:45 +02:00
|
|
|
check_rundir:
|
2013-09-17 18:20:40 +02:00
|
|
|
@if [ ! -d "$(dir $(RUN_DIR))" -a "$(CHECK_RUN_DIR)" = 1 ]; then \
|
2013-08-05 08:39:45 +02:00
|
|
|
echo "***** Parent of $(RUN_DIR) does not exist. Maybe set different RUN_DIR="; \
|
|
|
|
echo "***** e.g. make RUN_DIR=/dev/.mdadm" ; \
|
|
|
|
echo "***** or set CHECK_RUN_DIR=0"; exit 1; \
|
|
|
|
fi
|
|
|
|
|
2013-07-02 08:06:55 +02:00
|
|
|
everything: all mdadm.static swap_super test_stripe raid6check \
|
2008-05-19 04:07:43 +02:00
|
|
|
mdassemble mdassemble.auto mdassemble.static mdassemble.man \
|
2011-04-11 06:54:16 +02:00
|
|
|
mdadm.Os mdadm.O2 man
|
2009-03-10 06:38:37 +01:00
|
|
|
everything-test: all mdadm.static swap_super test_stripe \
|
|
|
|
mdassemble.auto mdassemble.static mdassemble.man \
|
2011-04-11 06:54:16 +02:00
|
|
|
mdadm.Os mdadm.O2 man
|
2007-02-22 04:59:31 +01:00
|
|
|
# mdadm.uclibc and mdassemble.uclibc don't work on x86-64
|
2005-08-26 04:26:37 +02:00
|
|
|
# mdadm.tcc doesn't work..
|
2003-02-12 01:17:26 +01:00
|
|
|
|
2014-11-25 01:44:18 +01:00
|
|
|
mdadm : $(OBJS) | check_rundir
|
2011-04-11 06:54:42 +02:00
|
|
|
$(CC) $(CFLAGS) $(LDFLAGS) -o mdadm $(OBJS) $(LDLIBS)
|
2001-06-08 04:36:23 +02:00
|
|
|
|
2006-05-29 06:09:21 +02:00
|
|
|
mdadm.static : $(OBJS) $(STATICOBJS)
|
2016-01-28 03:28:58 +01:00
|
|
|
$(CC) $(CFLAGS) $(LDFLAGS) -static -o mdadm.static $(OBJS) $(STATICOBJS) $(LDLIBS)
|
2003-02-12 01:17:26 +01:00
|
|
|
|
2010-08-19 08:48:34 +02:00
|
|
|
mdadm.tcc : $(SRCS) $(INCL)
|
2003-02-12 01:17:26 +01:00
|
|
|
$(TCC) -o mdadm.tcc $(SRCS)
|
|
|
|
|
2010-08-19 08:48:34 +02:00
|
|
|
mdadm.klibc : $(SRCS) $(INCL)
|
2013-06-19 02:02:17 +02:00
|
|
|
rm -f $(OBJS)
|
2009-04-29 03:21:08 +02:00
|
|
|
$(CC) -nostdinc -iwithprefix include -I$(KLIBC)/klibc/include -I$(KLIBC)/linux/include -I$(KLIBC)/klibc/arch/i386/include -I$(KLIBC)/klibc/include/bits32 $(CFLAGS) $(SRCS)
|
2003-03-03 00:11:38 +01:00
|
|
|
|
2010-08-19 08:48:34 +02:00
|
|
|
mdadm.Os : $(SRCS) $(INCL)
|
2016-01-28 03:28:58 +01:00
|
|
|
$(CC) -o mdadm.Os $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -DHAVE_STDINT_H -Os $(SRCS) $(LDLIBS)
|
2007-05-22 01:46:36 +02:00
|
|
|
|
2010-08-19 08:48:34 +02:00
|
|
|
mdadm.O2 : $(SRCS) $(INCL) mdmon.O2
|
2016-01-28 03:28:58 +01:00
|
|
|
$(CC) -o mdadm.O2 $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -DHAVE_STDINT_H -O2 -D_FORTIFY_SOURCE=2 $(SRCS) $(LDLIBS)
|
2010-03-03 00:54:17 +01:00
|
|
|
|
2010-08-19 08:48:34 +02:00
|
|
|
mdmon.O2 : $(MON_SRCS) $(INCL) mdmon.h
|
2016-01-28 03:28:58 +01:00
|
|
|
$(CC) -o mdmon.O2 $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(MON_LDFLAGS) -DHAVE_STDINT_H -O2 -D_FORTIFY_SOURCE=2 $(MON_SRCS) $(LDLIBS)
|
2007-05-22 01:46:36 +02:00
|
|
|
|
2010-07-02 02:28:14 +02:00
|
|
|
# use '-z now' to guarantee no dynamic linker interactions with the monitor thread
|
2014-11-25 01:44:18 +01:00
|
|
|
mdmon : $(MON_OBJS) | check_rundir
|
2011-04-11 06:54:42 +02:00
|
|
|
$(CC) $(CFLAGS) $(LDFLAGS) $(MON_LDFLAGS) -Wl,-z,now -o mdmon $(MON_OBJS) $(LDLIBS)
|
2008-05-15 08:48:52 +02:00
|
|
|
msg.o: msg.c msg.h
|
2008-05-15 08:48:37 +02:00
|
|
|
|
2012-07-16 23:56:54 +02:00
|
|
|
test_stripe : restripe.c xmalloc.o mdadm.h
|
2016-01-13 00:01:02 +01:00
|
|
|
$(CC) $(CFLAGS) $(CXFLAGS) $(LDFLAGS) -o test_stripe xmalloc.o -DMAIN restripe.c
|
2006-03-13 06:51:32 +01:00
|
|
|
|
2011-04-05 00:56:41 +02:00
|
|
|
raid6check : raid6check.o mdadm.h $(CHECK_OBJS)
|
|
|
|
$(CC) $(CXFLAGS) $(LDFLAGS) -o raid6check raid6check.o $(CHECK_OBJS)
|
RAID-6 check standalone
Hi Neil,
please find attached a patch, to mdadm-3.2 base, including
a standalone versione of the raid-6 check.
This is basically a re-working (and hopefully improvement)
of the already implemented check in "restripe.c".
I splitted the check function into "collect" and "stats",
so that the second one could be easily replaced.
The API is also simplified.
The command line option are reduced, since we only level
is raid-6, but the ":offset" option is included.
The output reports the block/stripe rotation, P/Q errors
and the possible HDD (or unknown).
BTW, the patch applies also to the already patched "restripe.c",
including the last ":offset" patch (which is not yet in git).
Other item is that due to "sysfs.c" linking (see below) the
"Makefile" needed some changes, I hope this is not a problem.
Next steps (TODO list you like) would be:
1) Add the "sysfs.c" code in order to retrieve the HDDs info
from the MD device. It is already linked, together with the
whole (mdadm) universe, since it seems it cannot leave alone.
I'll need some advice or hint on how to do use it. I checked
"sysfs.c", but before I dig deep into it maybe better to
have some advice (maybe just one function call will do it).
2) Add the suspend lo/hi control. Fellow John Robinson was
suggesting to look into "Grow.c", which I did, but I guess
the same story as 1) is valid: better to have some hint on
where to look before wasting time.
3) Add a repair option (future). This should have different
levels, like "all", "disk", "stripe". That is, fix everything
(more or less like "repair"), fix only if a disk is clearly
having problems, fix each stripe which has clearly a problem
(but maybe different stripes may belong to different HDDs).
So, for the point 1) and 2) would be nice to have some more
detail on where to look what. Point 3) we will discuss later.
Thanks, please consider for inclusion,
bye,
pg
Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-21 03:52:44 +01:00
|
|
|
|
2010-08-19 08:48:34 +02:00
|
|
|
mdassemble : $(ASSEMBLE_SRCS) $(INCL)
|
2012-08-12 21:24:16 +02:00
|
|
|
$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(ASSEMBLE_FLAGS) -o mdassemble $(ASSEMBLE_SRCS) $(STATICSRC)
|
|
|
|
|
|
|
|
mdassemble.diet : $(ASSEMBLE_SRCS) $(INCL)
|
2004-01-22 03:10:29 +01:00
|
|
|
rm -f $(OBJS)
|
2006-05-29 06:09:21 +02:00
|
|
|
$(DIET_GCC) $(ASSEMBLE_FLAGS) -o mdassemble $(ASSEMBLE_SRCS) $(STATICSRC)
|
2004-01-22 03:10:29 +01:00
|
|
|
|
2010-08-19 08:48:34 +02:00
|
|
|
mdassemble.static : $(ASSEMBLE_SRCS) $(INCL)
|
2004-11-01 05:49:34 +01:00
|
|
|
rm -f $(OBJS)
|
2014-06-05 08:38:29 +02:00
|
|
|
$(CC) $(LDFLAGS) $(CPPFLAGS) $(ASSEMBLE_FLAGS) -static -DHAVE_STDINT_H -o mdassemble.static $(ASSEMBLE_SRCS) $(STATICSRC)
|
2004-11-01 05:49:34 +01:00
|
|
|
|
2010-08-19 08:48:34 +02:00
|
|
|
mdassemble.auto : $(ASSEMBLE_SRCS) $(INCL) $(ASSEMBLE_AUTO_SRCS)
|
2008-05-19 04:07:43 +02:00
|
|
|
rm -f mdassemble.static
|
|
|
|
$(MAKE) MDASSEMBLE_AUTO=1 mdassemble.static
|
|
|
|
mv mdassemble.static mdassemble.auto
|
|
|
|
|
2010-08-19 08:48:34 +02:00
|
|
|
mdassemble.uclibc : $(ASSEMBLE_SRCS) $(INCL)
|
2006-05-26 06:28:33 +02:00
|
|
|
rm -f $(OJS)
|
2006-05-29 06:09:21 +02:00
|
|
|
$(UCLIBC_GCC) $(ASSEMBLE_FLAGS) -DUCLIBC -DHAVE_STDINT_H -static -o mdassemble.uclibc $(ASSEMBLE_SRCS) $(STATICSRC)
|
2004-01-22 03:10:29 +01:00
|
|
|
|
2004-11-01 05:49:34 +01:00
|
|
|
# This doesn't work
|
2010-08-19 08:48:34 +02:00
|
|
|
mdassemble.klibc : $(ASSEMBLE_SRCS) $(INCL)
|
2004-11-01 05:49:34 +01:00
|
|
|
rm -f $(OBJS)
|
2006-05-29 04:06:32 +02:00
|
|
|
$(KLIBC_GCC) $(ASSEMBLE_FLAGS) -o mdassemble $(ASSEMBLE_SRCS)
|
2004-01-22 03:10:29 +01:00
|
|
|
|
2010-05-28 14:12:41 +02:00
|
|
|
mdadm.8 : mdadm.8.in
|
2012-05-03 06:16:56 +02:00
|
|
|
sed -e 's/{DEFAULT_METADATA}/$(DEFAULT_METADATA)/g' \
|
|
|
|
-e 's,{MAP_PATH},$(MAP_PATH),g' mdadm.8.in > mdadm.8
|
2010-05-28 14:12:41 +02:00
|
|
|
|
2002-03-08 01:03:52 +01:00
|
|
|
mdadm.man : mdadm.8
|
2014-07-03 07:29:03 +02:00
|
|
|
man -l mdadm.8 > mdadm.man
|
2002-03-07 00:17:40 +01:00
|
|
|
|
2009-06-02 06:06:05 +02:00
|
|
|
mdmon.man : mdmon.8
|
2014-07-03 07:29:03 +02:00
|
|
|
man -l mdmon.8 > mdmon.man
|
2009-06-02 06:06:05 +02:00
|
|
|
|
2002-03-15 06:21:36 +01:00
|
|
|
md.man : md.4
|
2014-07-03 07:29:03 +02:00
|
|
|
man -l md.4 > md.man
|
2002-03-15 06:21:36 +01:00
|
|
|
|
|
|
|
mdadm.conf.man : mdadm.conf.5
|
2014-07-03 07:29:03 +02:00
|
|
|
man -l mdadm.conf.5 > mdadm.conf.man
|
2002-03-15 06:21:36 +01:00
|
|
|
|
2005-06-14 08:42:25 +02:00
|
|
|
mdassemble.man : mdassemble.8
|
2014-07-03 07:29:03 +02:00
|
|
|
man -l mdassemble.8 > mdassemble.man
|
2005-06-14 08:42:25 +02:00
|
|
|
|
2011-08-09 02:43:58 +02:00
|
|
|
raid6check.man : raid6check.8
|
2014-07-03 07:29:03 +02:00
|
|
|
man -l raid6check.8 > raid6check.man
|
2011-08-09 02:43:58 +02:00
|
|
|
|
2010-08-19 08:48:34 +02:00
|
|
|
$(OBJS) : $(INCL) mdmon.h
|
|
|
|
$(MON_OBJS) : $(INCL) mdmon.h
|
2001-06-08 04:36:23 +02:00
|
|
|
|
2006-05-19 08:56:06 +02:00
|
|
|
sha1.o : sha1.c sha1.h md5.h
|
|
|
|
$(CC) $(CFLAGS) -DHAVE_STDINT_H -o sha1.o -c sha1.c
|
|
|
|
|
2008-11-04 10:50:39 +01:00
|
|
|
install : mdadm mdmon install-man install-udev
|
2002-04-06 00:00:28 +02:00
|
|
|
$(INSTALL) -D $(STRIP) -m 755 mdadm $(DESTDIR)$(BINDIR)/mdadm
|
2008-07-22 02:42:12 +02:00
|
|
|
$(INSTALL) -D $(STRIP) -m 755 mdmon $(DESTDIR)$(BINDIR)/mdmon
|
2006-05-29 04:18:22 +02:00
|
|
|
|
|
|
|
install-static : mdadm.static install-man
|
|
|
|
$(INSTALL) -D $(STRIP) -m 755 mdadm.static $(DESTDIR)$(BINDIR)/mdadm
|
|
|
|
|
|
|
|
install-tcc : mdadm.tcc install-man
|
|
|
|
$(INSTALL) -D $(STRIP) -m 755 mdadm.tcc $(DESTDIR)$(BINDIR)/mdadm
|
|
|
|
|
|
|
|
install-uclibc : mdadm.uclibc install-man
|
|
|
|
$(INSTALL) -D $(STRIP) -m 755 mdadm.uclibc $(DESTDIR)$(BINDIR)/mdadm
|
|
|
|
|
|
|
|
install-klibc : mdadm.klibc install-man
|
|
|
|
$(INSTALL) -D $(STRIP) -m 755 mdadm.klibc $(DESTDIR)$(BINDIR)/mdadm
|
|
|
|
|
2009-06-02 06:06:05 +02:00
|
|
|
install-man: mdadm.8 md.4 mdadm.conf.5 mdmon.8
|
2002-04-06 00:00:28 +02:00
|
|
|
$(INSTALL) -D -m 644 mdadm.8 $(DESTDIR)$(MAN8DIR)/mdadm.8
|
2009-06-02 06:06:05 +02:00
|
|
|
$(INSTALL) -D -m 644 mdmon.8 $(DESTDIR)$(MAN8DIR)/mdmon.8
|
2002-04-06 00:00:28 +02:00
|
|
|
$(INSTALL) -D -m 644 md.4 $(DESTDIR)$(MAN4DIR)/md.4
|
|
|
|
$(INSTALL) -D -m 644 mdadm.conf.5 $(DESTDIR)$(MAN5DIR)/mdadm.conf.5
|
2002-03-07 00:17:40 +01:00
|
|
|
|
2013-02-09 21:49:47 +01:00
|
|
|
install-udev: udev-md-raid-arrays.rules udev-md-raid-assembly.rules
|
2014-05-22 09:13:02 +02:00
|
|
|
@for file in 63-md-raid-arrays.rules 64-md-raid-assembly.rules ; \
|
2014-08-21 05:56:48 +02:00
|
|
|
do sed -e 's,BINDIR,$(BINDIR),g' udev-$${file#??-} > .install.tmp.1 && \
|
2015-08-05 07:10:43 +02:00
|
|
|
$(ECHO) $(INSTALL) -D -m 644 udev-$${file#??-} $(DESTDIR)$(UDEVDIR)/rules.d/$$file ; \
|
2014-08-21 05:56:48 +02:00
|
|
|
$(INSTALL) -D -m 644 .install.tmp.1 $(DESTDIR)$(UDEVDIR)/rules.d/$$file ; \
|
|
|
|
rm -f .install.tmp.1; \
|
2014-05-22 09:13:02 +02:00
|
|
|
done
|
2008-11-04 10:50:39 +01:00
|
|
|
|
2013-02-01 16:15:18 +01:00
|
|
|
install-systemd: systemd/mdmon@.service
|
2014-05-22 09:13:02 +02:00
|
|
|
@for file in mdmon@.service mdmonitor.service mdadm-last-resort@.timer \
|
2014-06-10 12:34:40 +02:00
|
|
|
mdadm-last-resort@.service mdadm-grow-continue@.service; \
|
2014-08-21 05:56:48 +02:00
|
|
|
do sed -e 's,BINDIR,$(BINDIR),g' systemd/$$file > .install.tmp.2 && \
|
2015-08-05 07:10:43 +02:00
|
|
|
$(ECHO) $(INSTALL) -D -m 644 systemd/$$file $(DESTDIR)$(SYSTEMD_DIR)/$$file ; \
|
2014-08-21 05:56:48 +02:00
|
|
|
$(INSTALL) -D -m 644 .install.tmp.2 $(DESTDIR)$(SYSTEMD_DIR)/$$file ; \
|
|
|
|
rm -f .install.tmp.2; \
|
2014-05-22 09:13:02 +02:00
|
|
|
done
|
|
|
|
@for file in mdadm.shutdown ; \
|
2014-08-21 05:56:48 +02:00
|
|
|
do sed -e 's,BINDIR,$(BINDIR),g' systemd/$$file > .install.tmp.3 && \
|
2015-08-05 07:10:43 +02:00
|
|
|
$(ECHO) $(INSTALL) -D -m 755 systemd/$$file $(DESTDIR)$(SYSTEMD_DIR)-shutdown/$$file ; \
|
2014-08-21 05:56:48 +02:00
|
|
|
$(INSTALL) -D -m 755 .install.tmp.3 $(DESTDIR)$(SYSTEMD_DIR)-shutdown/$$file ; \
|
|
|
|
rm -f .install.tmp.3; \
|
2014-05-22 09:13:02 +02:00
|
|
|
done
|
2013-12-11 00:47:54 +01:00
|
|
|
if [ -f /etc/SuSE-release -o -n "$(SUSE)" ] ;then $(INSTALL) -D -m 755 systemd/SUSE-mdadm_env.sh $(DESTDIR)$(SYSTEMD_DIR)/../scripts/mdadm_env.sh ;fi
|
2013-02-01 16:15:18 +01:00
|
|
|
|
2006-05-29 04:18:22 +02:00
|
|
|
uninstall:
|
2009-06-02 06:06:05 +02:00
|
|
|
rm -f $(DESTDIR)$(MAN8DIR)/mdadm.8 $(DESTDIR)$(MAN8DIR)/mdmon.8 $(DESTDIR)$(MAN4DIR)/md.4 $(DESTDIR)$(MAN5DIR)/mdadm.conf.5 $(DESTDIR)$(BINDIR)/mdadm
|
2006-05-29 04:18:22 +02:00
|
|
|
|
2013-06-27 06:09:48 +02:00
|
|
|
test: mdadm mdmon test_stripe swap_super raid6check
|
2012-11-20 02:15:11 +01:00
|
|
|
@echo "Please run './test' as root"
|
2007-05-22 01:46:36 +02:00
|
|
|
|
2013-06-19 02:02:17 +02:00
|
|
|
clean :
|
2008-05-15 08:48:37 +02:00
|
|
|
rm -f mdadm mdmon $(OBJS) $(MON_OBJS) $(STATICOBJS) core *.man \
|
2010-03-10 05:58:46 +01:00
|
|
|
mdadm.tcc mdadm.uclibc mdadm.static *.orig *.porig *.rej *.alt .merge_file_* \
|
|
|
|
mdadm.Os mdadm.O2 mdmon.O2 \
|
2008-05-19 04:07:43 +02:00
|
|
|
mdassemble mdassemble.static mdassemble.auto mdassemble.uclibc \
|
|
|
|
mdassemble.klibc swap_super \
|
RAID-6 check standalone
Hi Neil,
please find attached a patch, to mdadm-3.2 base, including
a standalone versione of the raid-6 check.
This is basically a re-working (and hopefully improvement)
of the already implemented check in "restripe.c".
I splitted the check function into "collect" and "stats",
so that the second one could be easily replaced.
The API is also simplified.
The command line option are reduced, since we only level
is raid-6, but the ":offset" option is included.
The output reports the block/stripe rotation, P/Q errors
and the possible HDD (or unknown).
BTW, the patch applies also to the already patched "restripe.c",
including the last ":offset" patch (which is not yet in git).
Other item is that due to "sysfs.c" linking (see below) the
"Makefile" needed some changes, I hope this is not a problem.
Next steps (TODO list you like) would be:
1) Add the "sysfs.c" code in order to retrieve the HDDs info
from the MD device. It is already linked, together with the
whole (mdadm) universe, since it seems it cannot leave alone.
I'll need some advice or hint on how to do use it. I checked
"sysfs.c", but before I dig deep into it maybe better to
have some advice (maybe just one function call will do it).
2) Add the suspend lo/hi control. Fellow John Robinson was
suggesting to look into "Grow.c", which I did, but I guess
the same story as 1) is valid: better to have some hint on
where to look before wasting time.
3) Add a repair option (future). This should have different
levels, like "all", "disk", "stripe". That is, fix everything
(more or less like "repair"), fix only if a disk is clearly
having problems, fix each stripe which has clearly a problem
(but maybe different stripes may belong to different HDDs).
So, for the point 1) and 2) would be nice to have some more
detail on where to look what. Point 3) we will discuss later.
Thanks, please consider for inclusion,
bye,
pg
Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-21 03:52:44 +01:00
|
|
|
init.cpio.gz mdadm.uclibc.static test_stripe raid6check raid6check.o mdmon \
|
2010-08-06 08:55:23 +02:00
|
|
|
mdadm.8
|
2001-06-08 04:36:23 +02:00
|
|
|
|
|
|
|
dist : clean
|
|
|
|
./makedist
|
2001-06-14 07:33:53 +02:00
|
|
|
|
2009-03-10 06:38:37 +01:00
|
|
|
testdist : everything-test clean
|
2006-02-06 05:18:12 +01:00
|
|
|
./makedist test
|
|
|
|
|
2001-06-14 07:33:53 +02:00
|
|
|
TAGS :
|
|
|
|
etags *.h *.c
|
2008-07-24 18:34:34 +02:00
|
|
|
|
|
|
|
DISTRO_MAKEFILE := $(wildcard distropkg/Makefile)
|
|
|
|
ifdef DISTRO_MAKEFILE
|
|
|
|
include $(DISTRO_MAKEFILE)
|
|
|
|
endif
|