xfsrestore: mmap dirent names for faster lookups
PATCH v4 4/9 xfsrestore: mmap dirent names for faster lookups
Pathname resolution in xfsrestore is about 4x faster if the file containing dirent names ("namreg") is memory mapped. If xfsrestore is unable to map the file (e.g., due to virtual memory constraints) fallback to the existing seek-and-read approach.
The file is mapped after all directory entries have been written to the "namreg" file. If the caller tries to add additional entries after the file has been mapped, it will be unmapped and restore will resort back to seek-and-read lookups.
--- restore/content.c | 2 - restore/namreg.c | 98 +++++++++++++++++++++++++++++++++++++----------------- restore/namreg.h | 6 ++- 3 files changed, 73 insertions(+), 33 deletions(-)
restore/content.c +1 -1
@@ -3026,7 +3026,7 @@ applydirdump( drive_t *drivep,return rv; } -if ((rv =namreg_flush ()) !=RV_OK ) { +if ((rv =namreg_map ()) !=RV_OK ) {return rv; }
restore/namreg.c +68 -30
160 lines not on this page · raw message
restore/namreg.h +4 -2
@@ -49,9 +49,11 @@ extern nrh_t namreg_add( char *name, siz*/ extern void namreg_del (nrh_t nrh ); -/* namreg_flush - flush namreg I/O buffer. Returns 0 if successful. +/* namreg_map - mmap the name registry, allowing for much +* faster namreg_get() lookups. once called, additional +* entries cannot be added. */ -extern rv_t namreg_flush (void ); +extern rv_t namreg_map (void );/* namreg_get - retrieves the name identified by the index. * fills the buffer with the null-terminated name from the registry.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 9 lines · Bill Kendall
Pathname resolution in xfsrestore is about 4x faster if the file containing dirent names ("namreg") is memory mapped. If xfsrestore is unable to map the file (e.g., due to virtual memory constraints) fallback to the existing seek-and-read approach.
The file is mapped after all directory entries have been written to the "namreg" file. If the caller tries to add additional entries after the file has been mapped, it will be unmapped and restore will resort back to seek-and-read lookups.
This looks much simpler indeed. Is it intentional that the namreg file is never unmapped any more?
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 6 lines · Christoph Hellwig
Quoted 5 lines · Bill Kendall
Pathname resolution in xfsrestore is about 4x faster if the file containing dirent names ("namreg") is memory mapped. If xfsrestore is unable to map the file (e.g., due to virtual memory constraints) fallback to the existing seek-and-read approach.
Quoted 7 lines
Quoted 4 lines
The file is mapped after all directory entries have been written to the "namreg" file. If the caller tries to add additional entries after the file has been mapped, it will be unmapped and restore will resort back to seek-and-read lookups.
This looks much simpler indeed. Is it intentional that the namreg file is never unmapped any more?
There are several modules in xfsrestore which map files. None of them currently contain a destructor/cleanup function for unmapping the files. It would be a good change to make though.
Bill
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 3 lines · Bill Kendall
There are several modules in xfsrestore which map files. None of them currently contain a destructor/cleanup function for unmapping the files. It would be a good change to make though.
If keeping it mapped later it's fine with me. So ACK from me for the whole series.
Alex, maybe it's time to push out another xfsdump release after this? There's quite a few changes that have accumulated.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 10 lines · Christoph Hellwig
Quoted 3 lines · Bill Kendall
There are several modules in xfsrestore which map files. None of them currently contain a destructor/cleanup function for unmapping the files. It would be a good change to make though.
If keeping it mapped later it's fine with me. So ACK from me for the whole series.
Alex, maybe it's time to push out another xfsdump release after this? There's quite a few changes that have accumulated.
Yes, I had planned to do that once we got Bill's series committed. I am doing a final test of it today before pushing it to the -dev tree, for starters.
I also wanted to update my metadump series and, after getting that committed, mark a new release for xfsprogs as well. I thought I'd do these releases at the same time but I guess they don't have to be.
-Alex
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs