It appears to be an issue with the initial sparse file allocation. When I manually create 2GB datafiles using dd from /dev/zero, instead of allowing MongoDB to allocate them as needed, compression seems to be working correctly. -----Original Message----- From: Liu Bo [mailto:bo.li.liu@xxxxxxxxxx] Sent: Wednesday, December 05, 2012 11:59 PM To: Thorn Roby Cc: linux-btrfs@xxxxxxxxxxxxxxx Subject: Re: Mounted compress-force=zlib, compresses when files copied in, but not when written directly by application On Wed, Dec 05, 2012 at 05:42:51PM +0000, Thorn Roby wrote: > My previous reply was incorrect in one point - the data is never copied from the transaction log into the sparse datafiles, instead the application writes the same data independently to both locations. > Also, I failed to mention that the files are memmapped, and it's possible that the write operations attempt to use DIRECT_IO, which I believe is disabled by btrfs with compression - is it possible that an attempt to use DIRECT_IO or memmapped files would prevent compression? > Actually, writting with DIRECT_IO will fall back to buffer write for safety, and mmap files just dirty pages, should be same with buffer write, so it might be other reasons. thanks, liubo -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html
