Greg Freemyer wrote:
On Wed, Jun 12, 2013 at 6:38 PM, Linda Walsh
wrote: Greg Freemyer wrote:
open() write() fsync() posix_fadvise(fd, 0, len, POSIX_FADV_DONTNEED) close()
FWIW -- the calls are *advisory*, meaning the kernel may still not do what you want, versus, O_DIRECT you are avoiding the membuffer and its associated "garbage collection", altogether. So if it works for you, yeay!
Asking if it works seems like an easy question for the xfs list, but it seems like it should be filesystem independent to me.
I will likely work, but I used that call to fix xfs_fsr to not eat my memory and submitted the patch. The bit where it reads files from the old position and writes to the new -- it used kernel buff reads and I would notice my buffers get thrashed. So I tried that and it worked great. The xfs people didn't really want to add a posix call as there was no reason to write through the kernel in the first place, so later one of them came out with a similar patch that used O_direct for the file reading as well as the file writing(which due to how xfs_fsr reorganizes the disk was already O_DIRECT). So their preference was to use O_DIRECT which is probably better for this use case -- known, fixed-writes occurring at regular intervals. IF the write call took any real time to perform (which would likely be negligible), it could be done in a separate thread in background (roll-yur-own AIO -- or it could be done in linux AID calls, but I doubt either would be necessary the usage). Since there's no reason to buffer the data in ram, there doesn't seem to be much benefit to writing through the kernel file-buffers. Anyway, in their use case, O_DIRECT was a more efficient choice. I was just tossing out other options cuz it sounded like he didn't like O_DIRECT. Meh. ;-) -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org