FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Device-mapper Development

 
 
LinkBack Thread Tools
 
Old 05-04-2010, 04:01 AM
Mike Anderson
 
Default dm: Add feature flags to dm-mpath

Add a feature flag attribute to the multipath structure.

Signed-off-by: Mike Anderson <andmike@linux.vnet.ibm.com>
---
drivers/md/dm-mpath.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
index 826bce7..4200d03 100644
--- a/drivers/md/dm-mpath.c
+++ b/drivers/md/dm-mpath.c
@@ -82,6 +82,7 @@ struct multipath {
unsigned saved_queue_if_no_path;/* Saved state during suspension */
unsigned pg_init_retries; /* Number of times to retry pg_init */
unsigned pg_init_count; /* Number of times pg_init called */
+ unsigned long features;

struct work_struct process_queued_ios;
struct list_head queued_ios;
@@ -118,6 +119,15 @@ static void trigger_event(struct work_struct *work);
static void activate_path(struct work_struct *work);
static void deactivate_path(struct work_struct *work);

+static int multipath_test_feature(struct multipath *m, unsigned feature)
+{
+ return test_bit(feature, &m->features);
+}
+
+static void multipath_set_feature(struct multipath *m, unsigned feature)
+{
+ set_bit(feature, &m->features);
+}

/*-----------------------------------------------
* Allocation routines
--
1.6.6.1

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
 
Old 05-05-2010, 08:01 PM
Mike Snitzer
 
Default dm: Add feature flags to dm-mpath

On Tue, May 04 2010 at 12:01am -0400,
Mike Anderson <andmike@linux.vnet.ibm.com> wrote:

> Add a feature flag attribute to the multipath structure.
>
> Signed-off-by: Mike Anderson <andmike@linux.vnet.ibm.com>
> ---
> drivers/md/dm-mpath.c | 10 ++++++++++
> 1 files changed, 10 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
> index 826bce7..4200d03 100644
> --- a/drivers/md/dm-mpath.c
> +++ b/drivers/md/dm-mpath.c
> @@ -82,6 +82,7 @@ struct multipath {
> unsigned saved_queue_if_no_path;/* Saved state during suspension */
> unsigned pg_init_retries; /* Number of times to retry pg_init */
> unsigned pg_init_count; /* Number of times pg_init called */
> + unsigned long features;

Why not use uint64_t?

> struct work_struct process_queued_ios;
> struct list_head queued_ios;
> @@ -118,6 +119,15 @@ static void trigger_event(struct work_struct *work);
> static void activate_path(struct work_struct *work);
> static void deactivate_path(struct work_struct *work);
>
> +static int multipath_test_feature(struct multipath *m, unsigned feature)
> +{
> + return test_bit(feature, &m->features);
> +}
> +
> +static void multipath_set_feature(struct multipath *m, unsigned feature)
> +{
> + set_bit(feature, &m->features);
> +}

You're using 'unsigned long' for features yet these wrapper functions
take 'unsigned'. unsigned allows you to use {test,set}_bit but in the
end we have fewer flags to work with...

Granted you're introducing the very first flag but...

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
 
Old 05-05-2010, 11:04 PM
Mike Anderson
 
Default dm: Add feature flags to dm-mpath

Mike Snitzer <snitzer@redhat.com> wrote:
> On Tue, May 04 2010 at 12:01am -0400,
> Mike Anderson <andmike@linux.vnet.ibm.com> wrote:
>
> > +++ b/drivers/md/dm-mpath.c
> > @@ -82,6 +82,7 @@ struct multipath {
> > unsigned saved_queue_if_no_path;/* Saved state during suspension */
> > unsigned pg_init_retries; /* Number of times to retry pg_init */
> > unsigned pg_init_count; /* Number of times pg_init called */
> > + unsigned long features;
>
> Why not use uint64_t?

I was just following dm.c mapped_device flags as an example, but could be
changed.
>
> > struct work_struct process_queued_ios;
> > struct list_head queued_ios;
> > @@ -118,6 +119,15 @@ static void trigger_event(struct work_struct *work);
> > static void activate_path(struct work_struct *work);
> > static void deactivate_path(struct work_struct *work);
> >
> > +static int multipath_test_feature(struct multipath *m, unsigned feature)
> > +{
> > + return test_bit(feature, &m->features);
> > +}
> > +
> > +static void multipath_set_feature(struct multipath *m, unsigned feature)
> > +{
> > + set_bit(feature, &m->features);
> > +}
>
> You're using 'unsigned long' for features yet these wrapper functions
> take 'unsigned'. unsigned allows you to use {test,set}_bit but in the
> end we have fewer flags to work with...
>
> Granted you're introducing the very first flag but...
>

As I indicated above I used dm.c bit setting as an example. The feature
bit nr plus the {test,set}_bit appeared like a good start but as you said
I was just introducing the first flag. I guess it depends on how many
features we think we might need.

-andmike
--
Michael Anderson
andmike@linux.vnet.ibm.com

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
 

Thread Tools




All times are GMT. The time now is 10:25 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org