From 103245b6fea8e7d77722e85ccb404ac1d928987d Mon Sep 17 00:00:00 2001 From: Stelian Pop Date: Thu, 6 Sep 2001 09:00:31 +0000 Subject: [PATCH] BLKSFBUF ioctl in dump. --- CHANGES | 8 +++++++- THANKS | 3 ++- dump/main.c | 16 ++++++++++------ dump/tape.c | 10 ++++++++-- 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/CHANGES b/CHANGES index dba3572..0ede091 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,4 @@ -$Id: CHANGES,v 1.135 2001/08/17 09:55:09 stelian Exp $ +$Id: CHANGES,v 1.136 2001/09/06 09:00:31 stelian Exp $ Changes between versions 0.4b23 and 0.4b24 (released ?????????????) =================================================================== @@ -31,6 +31,12 @@ Changes between versions 0.4b23 and 0.4b24 (released ?????????????) very large files were encountered. Thanks to Vladimir Nadvornik for the bug report. +8. Added a ioctl(BLKFLSBUF) in dump which should flush the + kernel buffer/page cache before starting the dump, helping + a bit those who use dump on mounted filesystems. Thanks to + John Yu and to Theodore T'so + for this suggestion. + Changes between versions 0.4b22 and 0.4b23 (released July 20, 2001) =================================================================== diff --git a/THANKS b/THANKS index 80e2063..4e4b0f8 100644 --- a/THANKS +++ b/THANKS @@ -1,4 +1,4 @@ -$Id: THANKS,v 1.46 2001/07/18 09:50:48 stelian Exp $ +$Id: THANKS,v 1.47 2001/09/06 09:00:31 stelian Exp $ Dump and restore were written by the people of the CSRG at the University of California, Berkeley. @@ -81,4 +81,5 @@ Daniel Veillard Daniel.Veillard@imag.fr Jason Venner jason@idiom.com Christian Weisgerber naddy@mips.rhein-neckar.de Kim Yong-jun loveyou@hackerslab.org +John Yu jky@it.bu.edu Ian Zimmerman itz@speakeasy.org> diff --git a/dump/main.c b/dump/main.c index 5e9c111..722ca71 100644 --- a/dump/main.c +++ b/dump/main.c @@ -41,7 +41,7 @@ #ifndef lint static const char rcsid[] = - "$Id: main.c,v 1.59 2001/08/16 15:24:21 stelian Exp $"; + "$Id: main.c,v 1.60 2001/09/06 09:00:32 stelian Exp $"; #endif /* not lint */ #include @@ -60,6 +60,7 @@ static const char rcsid[] = #include #include #ifdef __linux__ +#include #ifdef HAVE_EXT2FS_EXT2_FS_H #include #else @@ -628,6 +629,14 @@ main(int argc, char *argv[]) } /* end of size estimate */ #ifdef __linux__ + if ((diskfd = OPEN(disk, O_RDONLY)) < 0) { + msg("Cannot open %s\n", disk); + msg("The ENTIRE dump is aborted.\n"); + exit(X_STARTUP); + } +#ifdef BLKFLSBUF + (void)ioctl(diskfd, BLKFLSBUF); +#endif retval = dump_fs_open(disk, &fs); if (retval) { com_err(disk, retval, "while opening filesystem"); @@ -642,11 +651,6 @@ main(int argc, char *argv[]) msg("The ENTIRE dump is aborted.\n"); exit(X_STARTUP); } - if ((diskfd = OPEN(disk, O_RDONLY)) < 0) { - msg("Cannot open %s\n", disk); - msg("The ENTIRE dump is aborted.\n"); - exit(X_STARTUP); - } /* if no user label specified, use ext2 filesystem label if available */ if (spcl.c_label[0] == '\0') { const char *lbl; diff --git a/dump/tape.c b/dump/tape.c index 8d8933f..f61fc87 100644 --- a/dump/tape.c +++ b/dump/tape.c @@ -41,7 +41,7 @@ #ifndef lint static const char rcsid[] = - "$Id: tape.c,v 1.54 2001/08/16 15:24:21 stelian Exp $"; + "$Id: tape.c,v 1.55 2001/09/06 09:00:32 stelian Exp $"; #endif /* not lint */ #include @@ -72,6 +72,9 @@ int write(), read(); #include #include #ifdef __linux__ +#include +#undef atomic_read /* this get wrongly defined in kernel */ + /* headers and we don't want it */ #ifdef HAVE_EXT2FS_EXT2_FS_H #include #else @@ -562,7 +565,7 @@ close_rewind(void) void rollforward(void) { - register struct req *p, *q, *prev; + register struct req *p, *q = NULL, *prev; register struct slave *tslp; int i, size, savedtapea, got; union u_spcl *ntb, *otb; @@ -1046,6 +1049,9 @@ doslave(int cmd, int slave_number, int first) if ((diskfd = OPEN(disk, O_RDONLY)) < 0) quit("slave couldn't reopen disk: %s\n", strerror(errno)); #ifdef __linux__ +#ifdef BLKFLSBUF + (void)ioctl(diskfd, BLKFLSBUF); +#endif ext2fs_close(fs); retval = dump_fs_open(disk, &fs); if (retval) -- 2.39.2