+[cvs]
+ - Extract device sector size at mkfs time and issue warnings
+ if the requested filesystem sector size is too small.
+ - Sync up user/kernel source in libxfs, libxlog and headers.
+ - Skip realtime initialisation in libxfs mount path if the
+ caller is xfs_db, otherwise we get nonsense warnings.
+
xfsprogs-2.4.10 (12 May 2003)
- Fix a bug in mkfs - creating version 2 logs, an incorrect
stripe unit value was being passed to libxfs_clear_log.
int risfile; /* realtime "subvolume" is a reg file */ int rcreat; /* try to create realtime subvolume */
char *notvolmsg; /* format string for not XLV message */
int notvolok; /* set if not XLV => try data */
+ int setblksize; /* attempt to set device blksize */
/* output results */
dev_t ddev; /* device for data subvolume */
dev_t logdev; /* device for log subvolume */
long long logBBsize; /* size of log subvolume (BBs) */
/* (blocks allocated for use as
* log is stored in mount structure) */
- long long logBBstart; /* start block of log subvolume (BBs) */ long long rtsize; /* size of realtime subvolume (BBs) */
+ long long logBBstart; /* start block of log subvolume (BBs) */
+ long long rtsize; /* size of realtime subvolume (BBs) */
+ int dbsize; /* data subvolume device blksize */
+ int lbsize; /* log subvolume device blksize */
+ int rtbsize; /* realtime subvolume device blksize */
int dfd; /* data subvolume file descriptor */
int logfd; /* log subvolume file descriptor */
int rtfd; /* realtime subvolume file descriptor */
- int setblksize; /* attempt to set device block size */
} libxfs_init_t;
#define LIBXFS_EXIT_ON_FAILURE 0x0001 /* exit the program if a call fails */
void
platform_set_blocksize(int fd, char *path, int blocksize)
{
- return;
+}
+
+int
+platform_get_blocksize(int fd, char *path)
+{
+ return BBSIZE;
}
void
{
}
+int
+platform_get_blocksize(int fd, char *path)
+{
+ return BBSIZE;
+}
+
void
platform_flush_device(int fd)
{
exit(1);
}
-int
-check_open(char *path, int flags,char **rawfile,char **blockfile){
-
+static int
+check_open(char *path, int flags, char **rawfile, char **blockfile)
+{
int readonly = (flags & LIBXFS_ISREADONLY);
int inactive = (flags & LIBXFS_ISINACTIVE);
int dangerously = (flags & LIBXFS_DANGEROUSLY);
return 1;
}
-
-
/*
* libxfs initialization.
* Caller gets a 0 on failure (and we print a message), 1 on success.
dname = a->dname;
logname = a->logname;
rtname = a->rtname;
- a->ddev = a->logdev = a->rtdev = 0;
a->dfd = a->logfd = a->rtfd = -1;
+ a->ddev = a->logdev = a->rtdev = 0;
+ a->dbsize = a->lbsize = a->rtbsize = 0;
a->dsize = a->logBBsize = a->logBBstart = a->rtsize = 0;
(void)getcwd(curdir,MAXPATHLEN);
flags = a->isreadonly;
if (a->volname) {
-
if(!check_open(a->volname,flags,&rawfile,&blockfile))
goto done;
needcd = 1;
a->dcreat, readonly, a->setblksize);
a->dfd = libxfs_device_to_fd(a->ddev);
a->dsize = platform_findsize(rawfile);
+ a->dbsize = platform_get_blocksize(a->dfd, rawfile);
}
needcd = 1;
} else
a->lcreat, readonly, a->setblksize);
a->logfd = libxfs_device_to_fd(a->logdev);
a->logBBsize = platform_findsize(rawfile);
+ a->lbsize = platform_get_blocksize(a->logfd, rawfile);
}
needcd = 1;
} else
a->rcreat, readonly, a->setblksize);
a->rtfd = libxfs_device_to_fd(a->rtdev);
a->rtsize = platform_findsize(rawfile);
+ a->rtbsize = platform_get_blocksize(a->rtfd, rawfile);
}
needcd = 1;
} else
}
/* Initialize realtime fields in the mount structure */
- if (rtmount_init(mp)) {
+ if (!(flags & LIBXFS_MOUNT_DEBUGGER) && rtmount_init(mp)) {
fprintf(stderr, _("%s: realtime device init failed\n"),
progname);
- if (!(flags & LIBXFS_MOUNT_DEBUGGER))
return NULL;
}
}
ASSERT(mp->m_rootip != NULL);
}
- if ((flags & LIBXFS_MOUNT_ROOTINOS) && rtmount_inodes(mp))
- if (!(flags & LIBXFS_MOUNT_DEBUGGER))
- return NULL;
+ if ((flags & LIBXFS_MOUNT_ROOTINOS) &&
+ !(flags & LIBXFS_MOUNT_DEBUGGER) &&
+ rtmount_inodes(mp))
+ return NULL;
return mp;
}
struct stat64 *sptr, int fatal);
extern __int64_t platform_findsize (char *path);
extern void platform_set_blocksize (int fd, char *path, int blocksize);
+extern int platform_get_blocksize (int fd, char *path);
extern void platform_flush_device (int fd);
#endif /* LIBXFS_INIT_H */
return;
}
+void
+platform_get_blocksize(int fd, char *path)
+{
+ return BBSIZE;
+}
+
void
platform_flush_device(int fd)
{
#ifndef BLKBSZSET
# define BLKBSZSET _IOW(0x12,113,sizeof(int))
#endif
+#ifndef BLKSSZGET
+# define BLKSSZGET _IO(0x12,104)
+#endif
#define PROC_MOUNTED "/proc/mounts"
}
}
+int
+platform_get_blocksize(int fd, char *path)
+{
+ int blocksize;
+
+ if (ioctl(fd, BLKSSZGET, &blocksize) < 0) {
+ fprintf(stderr, _("%s: warning - cannot get sector size "
+ "from block device %s: %s\n"),
+ progname, path, strerror(errno));
+ blocksize = BBSIZE;
+ }
+ return blocksize;
+}
+
void
platform_flush_device(int fd)
{
(long long)dblocks, XFS_MIN_DATA_BLOCKS);
usage();
}
+
if (loginternal && xi.logdev) {
fprintf(stderr,
_("can't have both external and internal logs\n"));
_("data and log sector sizes must be equal for internal logs\n"));
usage();
}
+
+ if (xi.dbsize > sectorsize) {
+ fprintf(stderr, _(
+"Warning: the data subvolume sector size %u is less than the sector size \n\
+reported by the device (%u).\n"),
+ sectorsize, xi.dbsize);
+ }
+ if (!loginternal && xi.lbsize > lsectorsize) {
+ fprintf(stderr, _(
+"Warning: the log subvolume sector size %u is less than the sector size\n\
+reported by the device (%u).\n"),
+ lsectorsize, xi.lbsize);
+ }
+ if (rtsize && xi.rtsize > 0 && xi.rtbsize > sectorsize) {
+ fprintf(stderr, _(
+"Warning: the realtime subvolume sector size %u is less than the sector size\n\
+reported by the device (%u).\n"),
+ sectorsize, xi.rtbsize);
+ }
+
if (dirversion == 1)
i = max_trres_v1[sectorlog - XFS_MIN_SECTORSIZE_LOG]
[blocklog - XFS_MIN_BLOCKSIZE_LOG]
/*
* Align the logstart at stripe unit boundary.
*/
-
if (lsunit && ((logstart % lsunit) != 0)) {
logstart = fixup_log_stripe(mp, lsflag, logstart,
agsize, lsunit, &logblocks, blocklog);