When running xfs_fsr on a sparse filesystem image containing
approximately 8 million extents and 80GB of data, I noticed that the
page cache grew and consumed all the memory in the machine. It turns
out that xfs_fsr is using direct IO to write data, but buffered IO
to read data. Convert the read side to use direct IO to prevent page
cache blowouts.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Mark Tinguely <tinguely@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
(p->bs_extents < 2))
continue;
- if ((fd = jdm_open(fshandlep, p, O_RDWR)) < 0) {
+ fd = jdm_open(fshandlep, p, O_RDWR|O_DIRECT);
+ if (fd < 0) {
/* This probably means the file was
* removed while in progress of handling
* it. Just quietly ignore this file.
return -1;
}
- fd = jdm_open( fshandlep, &statbuf, O_RDWR);
+ fd = jdm_open(fshandlep, &statbuf, O_RDWR|O_DIRECT);
if (fd < 0) {
fsrprintf(_("unable to open handle %s: %s\n"),
fname, strerror(errno));