From: Nathan Scott Date: Mon, 9 Aug 2004 05:30:39 +0000 (+0000) Subject: Do not issue BLKFLSBUF to ramdisk devices. X-Git-Tag: v2.7.0~79 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ac4199444eba97e86d8af7ce3e60cf88542c9e20;p=thirdparty%2Fxfsprogs-dev.git Do not issue BLKFLSBUF to ramdisk devices. --- diff --git a/libxfs/darwin.c b/libxfs/darwin.c index b8138a0ac..ce66f66ec 100644 --- a/libxfs/darwin.c +++ b/libxfs/darwin.c @@ -71,7 +71,7 @@ platform_set_blocksize(int fd, char *path, int blocksize) } void -platform_flush_device(int fd) +platform_flush_device(int fd, dev_t device) { ioctl(fd, DKIOCSYNCHRONIZECACHE, NULL); } diff --git a/libxfs/freebsd.c b/libxfs/freebsd.c index aac56ffa9..fabd22c91 100644 --- a/libxfs/freebsd.c +++ b/libxfs/freebsd.c @@ -109,11 +109,13 @@ platform_check_iswritable(char *name, char *block, struct stat64 *s, int fatal) void platform_set_blocksize(int fd, char *path, int blocksize) { + return; } void -platform_flush_device(int fd) +platform_flush_device(int fd, dev_t device) { + return; } void diff --git a/libxfs/init.c b/libxfs/init.c index 8ad6dfd8b..12bd0c086 100644 --- a/libxfs/init.c +++ b/libxfs/init.c @@ -162,7 +162,7 @@ libxfs_device_close(dev_t dev) dev_map[d].dev = dev_map[d].fd = 0; fsync(fd); - platform_flush_device(fd); + platform_flush_device(fd, dev); close(fd); return; diff --git a/libxfs/init.h b/libxfs/init.h index 1c11df41f..77e2744a7 100644 --- a/libxfs/init.h +++ b/libxfs/init.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved. + * Copyright (c) 2000-2004 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 @@ -40,6 +40,6 @@ extern int platform_check_iswritable (char *path, char *block, struct stat64 *sptr, int fatal); extern void platform_findsizes (char *path, int fd, long long *sz, int *bsz); extern void platform_set_blocksize (int fd, char *path, int blocksize); -extern void platform_flush_device (int fd); +extern void platform_flush_device (int fd, dev_t device); #endif /* LIBXFS_INIT_H */ diff --git a/libxfs/irix.c b/libxfs/irix.c index 622f1ca62..1ab460cf6 100644 --- a/libxfs/irix.c +++ b/libxfs/irix.c @@ -60,7 +60,7 @@ platform_get_blocksize(int fd, char *path) } void -platform_flush_device(int fd) +platform_flush_device(int fd, dev_t device) { return; } diff --git a/libxfs/linux.c b/libxfs/linux.c index d4217bebf..30ab63261 100644 --- a/libxfs/linux.c +++ b/libxfs/linux.c @@ -51,6 +51,10 @@ extern char *progname; # define BLKSSZGET _IO(0x12,104) #endif +#ifndef RAMDISK_MAJOR +#define RAMDISK_MAJOR 1 /* ramdisk major number */ +#endif + #define PROC_MOUNTED "/proc/mounts" int @@ -121,9 +125,10 @@ platform_set_blocksize(int fd, char *path, int blocksize) } void -platform_flush_device(int fd) +platform_flush_device(int fd, dev_t device) { - ioctl(fd, BLKFLSBUF, 0); + if (major(device) != RAMDISK_MAJOR) + ioctl(fd, BLKFLSBUF, 0); } void