Merge of master-melb:xfs-cmds:22829a by kenmcd.
/*
- * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
+ * Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
SVTYPE_LAST =255
} sv_type_t;
-extern void get_subvol_stripe_wrapper (char *, sv_type_t, int *, int *);
+extern void get_subvol_stripe_wrapper (char *, sv_type_t, int *, int *, int *);
extern int get_driver_block_major (const char *, int);
#endif /* __VOLUME_H__ */
/*
- * Copyright (c) 2004 Silicon Graphics, Inc. All Rights Reserved.
+ * Copyright (c) 2004-2005 Silicon Graphics, Inc. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
sv_type_t type,
int *sunit,
int *swidth,
+ int *sectalign,
struct stat64 *sb)
{
int count, stripes = 0, stripesize = 0;
/* Update sizes */
*sunit = stripesize;
*swidth = (stripes * stripesize);
+ *sectalign = 0;
return 1;
}
/*
- * Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved.
+ * Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
#include "drivers.h"
void
-get_subvol_stripe_wrapper(char *dev, sv_type_t type, int *sunit, int *swidth)
+get_subvol_stripe_wrapper(
+ char *dev,
+ sv_type_t type,
+ int *sunit,
+ int *swidth,
+ int *sectalign)
{
- struct stat64 sb;
+ struct stat64 sb;
if (dev == NULL)
return;
exit(1);
}
- if ( dm_get_subvol_stripe(dev, type, sunit, swidth, &sb))
+ if ( dm_get_subvol_stripe(dev, type, sunit, swidth, sectalign, &sb))
return;
- if ( md_get_subvol_stripe(dev, type, sunit, swidth, &sb))
+ if ( md_get_subvol_stripe(dev, type, sunit, swidth, sectalign, &sb))
return;
- if ( lvm_get_subvol_stripe(dev, type, sunit, swidth, &sb))
+ if ( lvm_get_subvol_stripe(dev, type, sunit, swidth, sectalign, &sb))
return;
- if ( xvm_get_subvol_stripe(dev, type, sunit, swidth, &sb))
+ if ( xvm_get_subvol_stripe(dev, type, sunit, swidth, sectalign, &sb))
return;
- if (evms_get_subvol_stripe(dev, type, sunit, swidth, &sb))
+ if (evms_get_subvol_stripe(dev, type, sunit, swidth, sectalign, &sb))
return;
/* ... add new device drivers here */
* being used in the running kernel.
*/
int
-get_driver_block_major(const char *driver, int major)
+get_driver_block_major(
+ const char *driver,
+ int major)
{
- FILE *f;
- char buf[64], puf[64];
- int dmajor, match = 0;
+ FILE *f;
+ char buf[64], puf[64];
+ int dmajor, match = 0;
if ((f = fopen(DEVICES, "r")) == NULL)
return match;
/*
- * Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved.
+ * Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
*/
#ifdef __linux__
-extern int dm_get_subvol_stripe(char*, sv_type_t, int*, int*, struct stat64*);
-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*);
+extern int dm_get_subvol_stripe(char*, sv_type_t, int*, int*, int*,
+ struct stat64*);
+extern int md_get_subvol_stripe(char*, sv_type_t, int*, int*, int*,
+ struct stat64*);
+extern int lvm_get_subvol_stripe(char*, sv_type_t, int*, int*, int*,
+ struct stat64*);
+extern int xvm_get_subvol_stripe(char*, sv_type_t, int*, int*, int*,
+ struct stat64*);
+extern int evms_get_subvol_stripe(char*, sv_type_t, int*, int*, int*,
+ struct stat64*);
#else
#define stat64 stat
-#define dm_get_subvol_stripe(dev, type, a, b, stat) (-1)
-#define md_get_subvol_stripe(dev, type, a, b, stat) (-1)
-#define lvm_get_subvol_stripe(dev, type, a, b, stat) (-1)
-#define xvm_get_subvol_stripe(dev, type, a, b, stat) (-1)
-#define evms_get_subvol_stripe(dev, type, a, b, stat) (-1)
+#define dm_get_subvol_stripe(dev, type, a, b, c, stat) (-1)
+#define md_get_subvol_stripe(dev, type, a, b, c, stat) (-1)
+#define lvm_get_subvol_stripe(dev, type, a, b, c, stat) (-1)
+#define xvm_get_subvol_stripe(dev, type, a, b, c, stat) (-1)
+#define evms_get_subvol_stripe(dev, type, a, b, c, stat) (-1)
#endif
sv_type_t type,
int *sunit,
int *swidth,
+ int *sectalign,
struct stat64 *sb)
{
if (mnt_is_evms_subvol(sb->st_rdev)) {
/* Update sizes */
*sunit = info.size;
*swidth = *sunit * info.width;
+ *sectalign = 0;
close(fd);
return 1;
/*
- * Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved.
+ * Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
sv_type_t type,
int *sunit,
int *swidth,
+ int *sectalign,
struct stat64 *sb)
{
int lvpipe[2], stripes = 0, stripesize = 0;
/* Update sizes */
*sunit = stripesize << 1;
*swidth = (stripes * stripesize) << 1;
+ *sectalign = 0;
fclose(stream);
/*
- * Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved.
+ * Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
sv_type_t type,
int *sunit,
int *swidth,
+ int *sectalign,
struct stat64 *sb)
{
if (mnt_is_md_subvol(sb->st_rdev)) {
/* Update sizes */
*sunit = md.chunk_size >> 9;
*swidth = *sunit * md.nr_disks;
+ *sectalign = (md.level == 4 || md.level == 5 || md.level == 6);
return 1;
}
/*
- * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
+ * Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
sv_type_t type,
int *sunit,
int *swidth,
+ int *sectalign,
struct stat64 *sb)
{
int fd;
*sunit = subvol_stripe.unit_size;
*swidth = *sunit * subvol_stripe.width_size;
+ *sectalign = 0;
close(fd);
return 1;
}
char *rtfile;
char *rtsize;
xfs_sb_t *sbp;
+ int sectoralign;
int sectorlog;
unsigned int sectorsize;
int slflag;
/*
* Blocksize and sectorsize first, other things depend on them
+ * For RAID4/5/6 we want to align sector size and block size,
+ * so we need to start with the device geometry extraction too.
*/
if (!blflag && !bsflag) {
blocklog = XFS_DFL_BLOCKSIZE_LOG;
fprintf(stderr, _("illegal block size %d\n"), blocksize);
usage();
}
+
+ sectoralign = 0;
+ xlv_dsunit = xlv_dswidth = 0;
+ if (!nodsflag && !xi.disfile)
+ get_subvol_stripe_wrapper(dfile, SVTYPE_DATA,
+ &xlv_dsunit, &xlv_dswidth, §oralign);
+ if (sectoralign) {
+ sectorsize = blocksize;
+ sectorlog = libxfs_highbit32(sectorsize);
+ if (loginternal) {
+ lsectorsize = sectorsize;
+ lsectorlog = sectorlog;
+ }
+ }
if (sectorsize < XFS_MIN_SECTORSIZE ||
sectorsize > XFS_MAX_SECTORSIZE || sectorsize > blocksize) {
fprintf(stderr, _("illegal sector size %d\n"), sectorsize);
dummy1 = rswidth = 0;
if (!norsflag && !xi.risfile && !(!rtsize && xi.disfile))
- get_subvol_stripe_wrapper(dfile, SVTYPE_RT, &dummy1,
- &rswidth);
+ get_subvol_stripe_wrapper(dfile, SVTYPE_RT, &dummy1,
+ &rswidth, &dummy1);
/* check that rswidth is a multiple of fs blocksize */
if (!norsflag && rswidth && !(BBTOB(rswidth) % blocksize)) {
validate_ag_geometry(blocklog, dblocks, agsize, agcount);
- xlv_dsunit = xlv_dswidth = 0;
- if (!nodsflag && !xi.disfile)
- get_subvol_stripe_wrapper(dfile, SVTYPE_DATA,
- &xlv_dsunit, &xlv_dswidth);
if (!nodsflag && dsunit) {
if (xlv_dsunit && xlv_dsunit != dsunit) {
fprintf(stderr,