From: Song Liu <songliubraving@fb.com>
To: linux-raid@vger.kernel.org
Cc: shli@fb.com, dan.j.williams@intel.com, neilb@suse.de,
hch@infradead.org, Song Liu <songliubraving@fb.com>
Subject: [PATCH 6/7] Zero write-cache superblock in --zero-super
Date: Wed, 13 May 2015 23:43:55 -0700 [thread overview]
Message-ID: <1431585836-4103033-7-git-send-email-songliubraving@fb.com> (raw)
In-Reply-To: <1431585836-4103033-1-git-send-email-songliubraving@fb.com>
Signed-off-by: Song Liu <songliubraving@fb.com>
---
Kill.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/Kill.c b/Kill.c
index f2fdb85..9dc566b 100644
--- a/Kill.c
+++ b/Kill.c
@@ -29,6 +29,18 @@
#include "md_u.h"
#include "md_p.h"
+int KillR5LSuper(struct supertype *st, int fd)
+{
+ memset(st->r5l_sb, 0, LOG_BLOCK_SIZE);
+
+ if (lseek64(fd, 512 * (st->data_offset), 0) < 0LL)
+ return 1;
+ if (write(fd, st->r5l_sb, LOG_BLOCK_SIZE))
+ return 1;
+ fsync(fd);
+ return 0;
+}
+
int Kill(char *dev, struct supertype *st, int force, int verbose, int noexcl)
{
/*
@@ -60,8 +72,15 @@ int Kill(char *dev, struct supertype *st, int force, int verbose, int noexcl)
return 2;
}
st->ignore_hw_compat = 1;
+ st->data_offset = INVALID_SECTORS; /* load st->data_offset from sb for KillR5LSuper */
rv = st->ss->load_super(st, fd, dev);
if (rv == 0 || (force && rv >= 2)) {
+ if (st->r5l_sb) {
+ if (verbose > 0)
+ pr_err("zero write_cache superblock\n");
+ KillR5LSuper(st, fd);
+ }
+
st->ss->free_super(st);
st->ss->init_super(st, NULL, 0, "", NULL, NULL,
INVALID_SECTORS);
--
1.8.1
next prev parent reply other threads:[~2015-05-14 6:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-14 6:43 [PATCH 0/7] mdadm support for caching layer in raid 5/6 Song Liu
2015-05-14 6:43 ` [PATCH 1/7] Show device as cache in --detail Song Liu
2015-05-14 6:43 ` [PATCH 2/7] Enable create array with write cache (--write-cache DEVICE) Song Liu
2015-05-14 6:43 ` [PATCH 3/7] Create write-cache superblock in mdadm --create Song Liu
2015-05-14 6:43 ` [PATCH 4/7] Assemble array with writecache Song Liu
2015-05-14 6:43 ` [PATCH 5/7] Check write cache in incremental Song Liu
2015-05-14 6:43 ` Song Liu [this message]
2015-05-14 6:43 ` [PATCH 7/7] Add information about write-cache superblock to --examine Song Liu
[not found] ` <14d521c83b0.276a.cf392d89e21755b689a9b33faa59c92f@cse.yorku.ca>
2015-05-14 11:30 ` [PATCH 0/7] mdadm support for caching layer in raid 5/6 Jason Keltz
2015-05-14 18:01 ` Song Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1431585836-4103033-7-git-send-email-songliubraving@fb.com \
--to=songliubraving@fb.com \
--cc=dan.j.williams@intel.com \
--cc=hch@infradead.org \
--cc=linux-raid@vger.kernel.org \
--cc=neilb@suse.de \
--cc=shli@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox