xfs
[Top] [All Lists]

Re: xfsprogs patch for evms

To: Luciano Chavez <lnx1138@xxxxxxxxxx>
Subject: Re: xfsprogs patch for evms
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Thu, 1 Aug 2002 19:55:13 +0100
Cc: Christoph Hellwig <hch@xxxxxxxxxxxxx>, linux-xfs@xxxxxxxxxxx, lord@xxxxxxx
In-reply-to: <1028225798.16220.182.camel@chavez>; from lnx1138@xxxxxxxxxx on Thu, Aug 01, 2002 at 01:16:37PM -0500
References: <1028213377.16184.77.camel@chavez> <20020801161512.A14257@xxxxxxxxxxxxx> <1028216192.16184.116.camel@chavez> <1028225798.16220.182.camel@chavez>
Sender: owner-linux-xfs@xxxxxxxxxxx
User-agent: Mutt/1.2.5.1i
On Thu, Aug 01, 2002 at 01:16:37PM -0500, Luciano Chavez wrote:
> Hello,
> 
> I cleaned up the patch quite a bit and re-tested it. I hope y'all find
> this one acceptable. If there are any comments or questions regarding it
> then please let me know.

What about this one instead?  it fits the style of the support code of
the other volume mangers in current CVS.

only semantical change is that I dropped the O_NDELAY.  Was there a reason
for it?  also does evms appear as evms in /proc/devices? otherwise the
additional dynamic major detection won't work.


Index: libdisk/Makefile
===================================================================
RCS file: /cvs/linux-2.4-xfs/cmd/xfsprogs/libdisk/Makefile,v
retrieving revision 1.5
diff -u -p -r1.5 Makefile
--- libdisk/Makefile    2002/06/04 23:07:56     1.5
+++ libdisk/Makefile    2002/08/01 18:44:55
@@ -38,8 +38,8 @@ LT_CURRENT = 0
 LT_REVISION = 0
 LT_AGE = 0
 
-CFILES = fstype.c pttype.c md.c xvm.c lvm.c drivers.c mountinfo.c
-HFILES = fstype.h pttype.h md.h xvm.h
+CFILES = fstype.c pttype.c md.c xvm.c lvm.c drivers.c mountinfo.c evms.c
+HFILES = fstype.h pttype.h md.h xvm.h evms.h
 
 default: $(LTLIBRARY)
 
Index: libdisk/drivers.c
===================================================================
RCS file: /cvs/linux-2.4-xfs/cmd/xfsprogs/libdisk/drivers.c,v
retrieving revision 1.7
diff -u -p -r1.7 drivers.c
--- libdisk/drivers.c   2002/06/04 23:07:56     1.7
+++ libdisk/drivers.c   2002/08/01 18:44:55
@@ -40,6 +40,7 @@
 extern int  md_get_subvol_stripe(char*, sv_type_t, int*, int*, struct stat64*);
 extern int lvm_get_subvol_stripe(char*, sv_type_t, int*, int*, struct stat64*);
 extern int xvm_get_subvol_stripe(char*, sv_type_t, int*, int*, struct stat64*);
+extern int evms_get_subvol_stripe(char*, sv_type_t, int*, int*, struct 
stat64*);
 
 void
 get_subvol_stripe_wrapper(char *dev, sv_type_t type, int *sunit, int *swidth)
@@ -54,11 +55,13 @@ get_subvol_stripe_wrapper(char *dev, sv_
                exit(1);
        }
 
-       if ( md_get_subvol_stripe(dev, type, sunit, swidth, &sb))
+       if (md_get_subvol_stripe(dev, type, sunit, swidth, &sb))
                return;
        if (lvm_get_subvol_stripe(dev, type, sunit, swidth, &sb))
                return;
        if (xvm_get_subvol_stripe(dev, type, sunit, swidth, &sb))
+               return;
+       if (evms_get_subvol_stripe(dev, type, sunit, swidth, &sb))
                return;
        /* ... add new device drivers here */
 }
--- /dev/null   Thu Dec 13 11:34:58 2001
+++ libdisk/evms.c      Thu Aug  1 21:42:27 2002
@@ -0,0 +1,67 @@
+/*
+ *   Copyright (c) International Business Machines  Corp., 2002
+ *   Portions Copyright (c) 2002 Silicon Graphics, Inc.  All Rights Reserved.
+ *
+ *   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
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <volume.h>
+#include "evms.h"
+
+int
+mnt_is_evms_subvol(dev_t dev)
+{
+       if (major(dev) == EVMS_MAJOR)
+               return 1;
+       if (major(dev) == get_driver_block_major("evms"))
+               return 1;
+       return 0;
+}
+
+int
+evms_get_subvol_stripe(
+       char            *dfile,
+       sv_type_t       type,
+       int             *sunit,
+       int             *swidth,
+       struct stat64   *sb)
+{
+       if (mnt_is_evms_subvol(sb->st_rdev)) {
+               struct evms_vol_stripe_info info;
+               int fd;
+
+               fd = open(dfile, O_RDONLY);
+               if (fd < 0)
+                       return 0;
+
+               if (ioctl(fd, EVMS_GET_VOL_STRIPE_INFO, &info)) {
+                       fprintf(stderr,
+                               "Error getting EVMS stripe size from %s\n",
+                               dfile);
+                       exit(1);
+               }
+
+               *sunit = info.size;
+               *swidth = *sunit * info.width;
+
+               return 1;
+       }
+       return 0;
+}
--- /dev/null   Thu Dec 13 11:34:58 2001
+++ libdisk/evms.h      Thu Aug  1 21:43:49 2002
@@ -0,0 +1,38 @@
+/*
+ *   Copyright (c) International Business Machines  Corp., 2002
+ *
+ *   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
+ */
+
+#ifndef EVMS_MAJOR
+#define EVMS_MAJOR     117 /* we also check at runtime */
+#endif
+
+#define EVMS_GET_VOL_STRIPE_INFO_NUMBER         0xF0
+
+#define EVMS_GET_VOL_STRIPE_INFO \
+       _IOR(EVMS_MAJOR, EVMS_GET_VOL_STRIPE_INFO_NUMBER, struct 
evms_vol_stripe_info)
+
+/*
+ * struct evms_vol_stripe_info - contains stripe information for a volume
+ *
+ * unit: the stripe unit specified in 512 byte block units
+ * width: the number of stripe members or RAID data disks
+ *
+ */
+struct evms_vol_stripe_info {
+       __uint32_t size;
+       __uint32_t width;
+};


<Prev in Thread] Current Thread [Next in Thread>