All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] mdadm/r5cache: allow adding journal to array without journal
@ 2017-03-16 23:24 Song Liu
  2017-03-17 19:50 ` jes.sorensen
  0 siblings, 1 reply; 2+ messages in thread
From: Song Liu @ 2017-03-16 23:24 UTC (permalink / raw)
  To: linux-raid
  Cc: shli, neilb, kernel-team, dan.j.williams, hch, jes.sorensen, Song Liu

Currently, --add-journal can be only used to recreate broken journal
for arrays with journal since  creation. As the kernel code getting
more mature, this constraint is no longer necessary.

This patch allows --add-journal to add journal to array without
journal.

Signed-off-by: Song Liu <songliubraving@fb.com>
---
 Manage.c   | 9 ---------
 mdadm.8.in | 5 ++---
 2 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/Manage.c b/Manage.c
index 5c3d2b9..d038b68 100644
--- a/Manage.c
+++ b/Manage.c
@@ -946,7 +946,6 @@ int Manage_add(int fd, int tfd, struct mddev_dev *dv,
 
 	/* only add journal to array that supports journaling */
 	if (dv->disposition == 'j') {
-		struct mdinfo mdi;
 		struct mdinfo *mdp;
 
 		mdp = sysfs_read(fd, NULL, GET_ARRAY_STATE);
@@ -960,14 +959,6 @@ int Manage_add(int fd, int tfd, struct mddev_dev *dv,
 			pr_err("%s is not readonly, cannot add journal.\n", devname);
 			return -1;
 		}
-
-		sysfs_free(mdp);
-
-		tst->ss->getinfo_super(tst, &mdi, NULL);
-		if (mdi.journal_device_required == 0) {
-			pr_err("%s does not support journal device.\n", devname);
-			return -1;
-		}
 		disc.raid_disk = 0;
 	}
 
diff --git a/mdadm.8.in b/mdadm.8.in
index df1d460..9e5e896 100644
--- a/mdadm.8.in
+++ b/mdadm.8.in
@@ -1474,9 +1474,8 @@ the device is found or <slot>:missing in case the device is not found.
 
 .TP
 .BR \-\-add-journal
-Recreate journal for RAID-4/5/6 array that lost a journal device. In the
-current implementation, this command cannot add a journal to an array
-that had a failed journal. To avoid interrupting on-going write opertions,
+Add journal to an existing array, or recreate journal for RAID-4/5/6 array
+that lost a journal device. To avoid interrupting on-going write opertions,
 .B \-\-add-journal
 only works for array in Read-Only state.
 
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] mdadm/r5cache: allow adding journal to array without journal
  2017-03-16 23:24 [PATCH v2] mdadm/r5cache: allow adding journal to array without journal Song Liu
@ 2017-03-17 19:50 ` jes.sorensen
  0 siblings, 0 replies; 2+ messages in thread
From: jes.sorensen @ 2017-03-17 19:50 UTC (permalink / raw)
  To: Song Liu; +Cc: linux-raid, neilb, kernel-team

Song Liu <songliubraving@fb.com> writes:
> Currently, --add-journal can be only used to recreate broken journal
> for arrays with journal since  creation. As the kernel code getting
> more mature, this constraint is no longer necessary.
>
> This patch allows --add-journal to add journal to array without
> journal.
>
> Signed-off-by: Song Liu <songliubraving@fb.com>
> ---
>  Manage.c   | 9 ---------
>  mdadm.8.in | 5 ++---
>  2 files changed, 2 insertions(+), 12 deletions(-)

Hi Song,

I spotted this one after I had already applied the first patch with
this title, so I went back and removed the original one and applied this
one instead, but now the build breaks.

When posting a v2, please send it out as a response to the patch it is
meant to replace, like this:
  git send-email --in-reply-to=<....>

Second, please put a note in the commit why this is a v2.

I am going to revert them all for now. Please send me a fresh consistent
set to apply.

Thanks,
Jes

cc -Wall -Werror -Wstrict-prototypes -Wextra -Wno-unused-parameter -ggdb -DSendmail=\""/usr/sbin/sendmail -t"\" -DCONFFILE=\"/etc/mdadm.conf\" -DCONFFILE2=\"/etc/mdadm/mdadm.conf\" -DMAP_DIR=\"/run/mdadm\" -DMAP_FILE=\"map\" -DMDMON_DIR=\"/run/mdadm\" -DFAILED_SLOTS_DIR=\"/run/mdadm/failed-slots\" -DNO_COROSYNC -DNO_DLM -DVERSION=\"4.0-10-g707cf0a\" -DVERS_DATE="\"2017-03-17\"" -DUSE_PTHREADS -DBINDIR=\"/sbin\"  -c -o Manage.o Manage.c
Manage.c: In function ‘Manage_remove_journal’:
Manage.c:199:26: error: ‘MD_SB_HAS_JOURNAL’ undeclared (first use in this function)
  if (!(array.state & (1<<MD_SB_HAS_JOURNAL))) {
                          ^~~~~~~~~~~~~~~~~
Manage.c:199:26: note: each undeclared identifier is reported only once for each function it appears in
Manage.c:203:33: error: ‘MD_SB_JOURNAL_REMOVABLE’ undeclared (first use in this function)
  } else if (!(array.state & (1<<MD_SB_JOURNAL_REMOVABLE))) {
                                 ^~~~~~~~~~~~~~~~~~~~~~~
<builtin>: recipe for target 'Manage.o' failed
make: *** [Manage.o] Error 1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-03-17 19:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-16 23:24 [PATCH v2] mdadm/r5cache: allow adding journal to array without journal Song Liu
2017-03-17 19:50 ` jes.sorensen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.