* [PATCH 26/33] added --path <path_id> to give the information on the 'path-id' of removed device
[not found] <A9DE54D0CD747C4CB06DCE5B6FA2246FDA893C4F@irsmsx504.ger.corp.intel.com>
@ 2010-07-05 10:49 ` Hawrylewicz Czarnowski, Przemyslaw
2010-07-06 7:15 ` Neil Brown
1 sibling, 0 replies; 3+ messages in thread
From: Hawrylewicz Czarnowski, Przemyslaw @ 2010-07-05 10:49 UTC (permalink / raw)
To: linux-raid@vger.kernel.org
From: Czarnowska, Anna
Sent: Monday, July 05, 2010 11:40 AM
To: Neil Brown
Cc: linux-raid@vger.kernel.org; Czarnowska, Anna; Hawrylewicz Czarnowski, Przemyslaw; Labun, Marcin; Neubauer, Wojciech; Williams, Dan J; Ciechanowski, Ed; dledford@redhat.com
Subject: [PATCH 26/33] added --path <path_id> to give the information on the 'path-id' of removed device
From: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com>
<path-id> allows to identify the port to which given device is plugged in. In case of hot-removal, udev can pass this information for future use (eg. write this name as 'cookie' allowing to detect the fact of reinserting device to the same port).
--path <path-id> parameter has been added to device removal handle (and char *path has been added to IncrementalRemove() to pass this value) in order to pass path-id to this handler.
Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com>
---
Incremental.c | 8 +++++++-
ReadMe.c | 2 ++
mdadm.c | 15 ++++++++++++---
mdadm.h | 6 +++++-
4 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/Incremental.c b/Incremental.c index 4f52e3b..20e3445 100644
--- a/Incremental.c
+++ b/Incremental.c
@@ -941,13 +941,19 @@ int Incremental_container(struct supertype *st, char *devname, int verbose,
* Note: the device name must be a kernel name like "sda", so
* that we can find it in /proc/mdstat
*/
-int IncrementalRemove(char *devname, int verbose)
+int IncrementalRemove(char *devname, char *path, int verbose)
{
int mdfd;
int rv;
struct mdstat_ent *ent;
struct mddev_dev_s devlist;
+ if (!path) {
+ fprintf(stderr, Name ": incremental removal without --path <path_id> lacks "
+ "the possibility to re-add new device in this port\n");
+ return 1;
+ }
+
if (strchr(devname, '/')) {
fprintf(stderr, Name ": incremental removal requires a "
"kernel device name, not a file: %s\n", devname); diff --git a/ReadMe.c b/ReadMe.c index 5b59369..f1b11fb 100644
--- a/ReadMe.c
+++ b/ReadMe.c
@@ -191,6 +191,8 @@ struct option long_options[] = {
/* For Incremental */
{"rebuild-map", 0, 0, 'r'},
{"grab", 0, 0, 'g'}, /* grab devices for hot spare use */
+ {"path", 1, 0, IncrementalPath},
+
{0, 0, 0, 0}
};
diff --git a/mdadm.c b/mdadm.c
index a111b47..60b4e3b 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -104,6 +104,7 @@ int main(int argc, char *argv[])
int dosyslog = 0;
int rebuild_map = 0;
int auto_update_home = 0;
+ char *remove_path = NULL;
int print_help = 0;
FILE *outf;
@@ -913,6 +914,13 @@ int main(int argc, char *argv[])
case O(INCREMENTAL, 'g'):
new_disk = 1;
continue;
+ case O(INCREMENTAL, IncrementalPath):
+ if (!optarg) {
+ fprintf(stderr, Name ":option --path needs obligatory argument\n");
+ exit(2);
+ }
+ remove_path = strdup(optarg);
+ continue;
}
/* We have now processed all the valid options. Anything else is
* an error
@@ -1559,9 +1567,10 @@ int main(int argc, char *argv[])
rv = 1;
break;
}
- if (devmode == 'f')
- rv = IncrementalRemove(devlist->devname, verbose-quiet);
- else if (new_disk > 0)
+ if (devmode == 'f') {
+ rv = IncrementalRemove(devlist->devname, remove_path, verbose-quiet);
+ free(remove_path);
+ } else if (new_disk > 0)
rv = IncrementalNew(devlist->devname, verbose-quiet,
export);
else
diff --git a/mdadm.h b/mdadm.h
index 86f5370..79eed16 100644
--- a/mdadm.h
+++ b/mdadm.h
@@ -275,6 +275,9 @@ enum special_options {
AutoDetect,
Waitclean,
DetailPlatform,
+ HotPlug,
+ HotUnplug,
+ IncrementalPath
};
enum disk_status {
@@ -907,7 +910,7 @@ extern int Incremental_container(struct supertype *st, char *devname,
int trustworthy);
extern void RebuildMap(void);
extern int IncrementalScan(int verbose); -extern int IncrementalRemove(char *devname, int verbose);
+extern int IncrementalRemove(char *devname, char *path, int verbose);
extern int IncrementalNew(char *devname, int verbose, int export); extern int CreateBitmap(char *filename, int force, char uuid[16],
unsigned long chunksize, unsigned long daemon_sleep, @@ -1024,6 +1027,7 @@ extern char *devnum2devname(int num); extern int devname2devnum(char *name); extern int stat2devnum(struct stat *st); extern int fd2devnum(int fd);
+extern void free_mddev_dev(mddev_dev_t devlist);
extern char *get_devpath_from_devname(char *devname); extern char *get_array_devname(char *array); extern char *get_array_devname_by_uuid(int (*uuid)[4]);
--
1.6.4.2
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 26/33] added --path <path_id> to give the information on the 'path-id' of removed device
[not found] <A9DE54D0CD747C4CB06DCE5B6FA2246FDA893C4F@irsmsx504.ger.corp.intel.com>
2010-07-05 10:49 ` [PATCH 26/33] added --path <path_id> to give the information on the 'path-id' of removed device Hawrylewicz Czarnowski, Przemyslaw
@ 2010-07-06 7:15 ` Neil Brown
2010-07-08 15:58 ` Hawrylewicz Czarnowski, Przemyslaw
1 sibling, 1 reply; 3+ messages in thread
From: Neil Brown @ 2010-07-06 7:15 UTC (permalink / raw)
To: Czarnowska, Anna
Cc: linux-raid@vger.kernel.org, Hawrylewicz Czarnowski, Przemyslaw,
Labun, Marcin, Neubauer, Wojciech, Williams, Dan J,
Ciechanowski, Ed, dledford@redhat.com
On Mon, 5 Jul 2010 10:40:13 +0100
"Czarnowska, Anna" <anna.czarnowska@intel.com> wrote:
> From: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com>
>
>
>
> <path-id> allows to identify the port to which given device is plugged in. In case of hot-removal, udev can pass this information for future use (eg. write this name as 'cookie' allowing to detect the fact of reinserting device to the same port).
>
> --path <path-id> parameter has been added to device removal handle (and char *path has been added to IncrementalRemove() to pass this value) in order to pass path-id to this handler.
>
>
>
> Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com<mailto:przemyslaw.hawrylewicz.czarnowski@intel.com>>
>
> ---
>
> Incremental.c | 8 +++++++-
>
> ReadMe.c | 2 ++
>
> mdadm.c | 15 ++++++++++++---
>
> mdadm.h | 6 +++++-
>
> 4 files changed, 26 insertions(+), 5 deletions(-)
>
>
>
> diff --git a/Incremental.c b/Incremental.c index 4f52e3b..20e3445 100644
>
> --- a/Incremental.c
>
> +++ b/Incremental.c
>
> @@ -941,13 +941,19 @@ int Incremental_container(struct supertype *st, char *devname, int verbose,
>
> * Note: the device name must be a kernel name like "sda", so
>
> * that we can find it in /proc/mdstat
>
> */
>
> -int IncrementalRemove(char *devname, int verbose)
>
> +int IncrementalRemove(char *devname, char *path, int verbose)
>
> {
>
> int mdfd;
>
> int rv;
>
> struct mdstat_ent *ent;
>
> struct mddev_dev_s devlist;
>
>
>
> + if (!path) {
>
> + fprintf(stderr, Name ": incremental removal without --path <path_id> lacks "
>
> + "the possibility to re-add new device in this port\n");
>
> + return 1;
>
> + }
>
> +
It may be appropriate to give a warning here (though I doubt it). It is
certainly no appropriate to fail IncrementalRemove just because no path was
specified.
> +++ b/mdadm.h
>
> @@ -275,6 +275,9 @@ enum special_options {
>
> AutoDetect,
>
> Waitclean,
>
> DetailPlatform,
>
> + HotPlug,
>
> + HotUnplug,
>
> + IncrementalPath
>
> };
Please only add options here as you actually use them.
Hotplug and HotUnplug are not used, so should not be here.
NeilBrown
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH 26/33] added --path <path_id> to give the information on the 'path-id' of removed device
2010-07-06 7:15 ` Neil Brown
@ 2010-07-08 15:58 ` Hawrylewicz Czarnowski, Przemyslaw
0 siblings, 0 replies; 3+ messages in thread
From: Hawrylewicz Czarnowski, Przemyslaw @ 2010-07-08 15:58 UTC (permalink / raw)
To: Neil Brown, Czarnowska, Anna
Cc: linux-raid@vger.kernel.org, Labun, Marcin, Neubauer, Wojciech,
Williams, Dan J, Ciechanowski, Ed, dledford@redhat.com
> -----Original Message-----
> From: linux-raid-owner@vger.kernel.org [mailto:linux-raid-
> owner@vger.kernel.org] On Behalf Of Neil Brown
> Sent: Tuesday, July 06, 2010 9:15 AM
> To: Czarnowska, Anna
> Cc: linux-raid@vger.kernel.org; Hawrylewicz Czarnowski, Przemyslaw;
> Labun, Marcin; Neubauer, Wojciech; Williams, Dan J; Ciechanowski, Ed;
> dledford@redhat.com
> Subject: Re: [PATCH 26/33] added --path <path_id> to give the
> information on the 'path-id' of removed device
>
> On Mon, 5 Jul 2010 10:40:13 +0100
> "Czarnowska, Anna" <anna.czarnowska@intel.com> wrote:
>
> > From: Przemyslaw Czarnowski
> <przemyslaw.hawrylewicz.czarnowski@intel.com>
> >
> >
> >
> > <path-id> allows to identify the port to which given device is
> plugged in. In case of hot-removal, udev can pass this information for
> future use (eg. write this name as 'cookie' allowing to detect the fact
> of reinserting device to the same port).
> >
> > --path <path-id> parameter has been added to device removal handle
> (and char *path has been added to IncrementalRemove() to pass this
> value) in order to pass path-id to this handler.
> >
> >
> >
> > Signed-off-by: Przemyslaw Czarnowski
> <przemyslaw.hawrylewicz.czarnowski@intel.com<mailto:przemyslaw.hawrylew
> icz.czarnowski@intel.com>>
> >
> > ---
> >
> > Incremental.c | 8 +++++++-
> >
> > ReadMe.c | 2 ++
> >
> > mdadm.c | 15 ++++++++++++---
> >
> > mdadm.h | 6 +++++-
> >
> > 4 files changed, 26 insertions(+), 5 deletions(-)
> >
> >
> >
> > diff --git a/Incremental.c b/Incremental.c index 4f52e3b..20e3445
> 100644
> >
> > --- a/Incremental.c
> >
> > +++ b/Incremental.c
> >
> > @@ -941,13 +941,19 @@ int Incremental_container(struct supertype *st,
> char *devname, int verbose,
> >
> > * Note: the device name must be a kernel name like "sda", so
> >
> > * that we can find it in /proc/mdstat
> >
> > */
> >
> > -int IncrementalRemove(char *devname, int verbose)
> >
> > +int IncrementalRemove(char *devname, char *path, int verbose)
> >
> > {
> >
> > int mdfd;
> >
> > int rv;
> >
> > struct mdstat_ent *ent;
> >
> > struct mddev_dev_s devlist;
> >
> >
> >
> > + if (!path) {
> >
> > + fprintf(stderr, Name ": incremental removal without --
> path <path_id> lacks "
> >
> > + "the possibility to re-add new device in this
> port\n");
> >
> > + return 1;
> >
> > + }
> >
> > +
>
>
> It may be appropriate to give a warning here (though I doubt it). It
> is
> certainly no appropriate to fail IncrementalRemove just because no path
> was
> specified.
Ok, seems reasonable, thanks
>
>
> > +++ b/mdadm.h
> >
> > @@ -275,6 +275,9 @@ enum special_options {
> >
> > AutoDetect,
> >
> > Waitclean,
> >
> > DetailPlatform,
> >
> > + HotPlug,
> >
> > + HotUnplug,
> >
> > + IncrementalPath
> >
> > };
>
> Please only add options here as you actually use them.
> Hotplug and HotUnplug are not used, so should not be here.
Good catch. I'll remove it. It's a part of an old code...
>
> NeilBrown
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-raid"
> in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-07-08 15:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <A9DE54D0CD747C4CB06DCE5B6FA2246FDA893C4F@irsmsx504.ger.corp.intel.com>
2010-07-05 10:49 ` [PATCH 26/33] added --path <path_id> to give the information on the 'path-id' of removed device Hawrylewicz Czarnowski, Przemyslaw
2010-07-06 7:15 ` Neil Brown
2010-07-08 15:58 ` Hawrylewicz Czarnowski, Przemyslaw
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).