diff --git a/CHANGES.md b/CHANGES.md index 8150c75d0..abb151a27 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -9,8 +9,7 @@ - (feature) Added `blocksize` option to the FUSE driver, which allows the `st_blksize` value to be configured for the mounted file system. - This is necessary on macOS as macFUSE derives the optimum read size - from this value. Use along with macFUSE's `iosize` for best effect. + Increasing this value can improve throughput for large files. - (feature) Added experimental `readahead` option to the FUSE driver. This can potentially increase throughput when performing sequential diff --git a/doc/dwarfs.md b/doc/dwarfs.md index 9387c35b4..e469a7ff0 100644 --- a/doc/dwarfs.md +++ b/doc/dwarfs.md @@ -33,11 +33,8 @@ options: memory. For more details, see mkdwarfs(1). - `-o blocksize=`*value*: - Size reported for files in `st_blksize`. This is 512 bytes - by default on Linux/Windows. On macOS, the value is 256 kiB, - as macFUSE uses this to derive the maximum size of a read - request. Use this along with macFUSE's `iosize` option to - tune throughput. + Size reported for files in `st_blksize`. You can use this to + optimize throughput in certain situations. - `-o readahead=`*value*: How much data to read ahead when receiving a read request. diff --git a/src/dwarfs/metadata_v2.cpp b/src/dwarfs/metadata_v2.cpp index a3c139cf2..1580c23b8 100644 --- a/src/dwarfs/metadata_v2.cpp +++ b/src/dwarfs/metadata_v2.cpp @@ -1554,7 +1554,7 @@ int metadata_::getattr(inode_view iv, file_stat* stbuf) const { : file_size(iv, mode); stbuf->ino = inode + inode_offset_; stbuf->blksize = options_.block_size; - stbuf->blocks = (stbuf->size + options_.block_size - 1) / options_.block_size; + stbuf->blocks = (stbuf->size + 511) / 512; stbuf->uid = iv.getuid(); stbuf->gid = iv.getgid(); stbuf->mtime = resolution * (timebase + iv.mtime_offset()); diff --git a/src/dwarfs_main.cpp b/src/dwarfs_main.cpp index f7ac250b5..9efedf9b4 100644 --- a/src/dwarfs_main.cpp +++ b/src/dwarfs_main.cpp @@ -138,11 +138,7 @@ namespace dwarfs { namespace { -#ifdef __APPLE__ -constexpr size_t const kDefaultBlockSize{static_cast(256) << 10}; -#else -constexpr size_t const kDefaultBlockSize{512}; -#endif +constexpr size_t const kDefaultBlockSize{static_cast(512) << 10}; struct options { // std::string isn't standard-layout on MSVC @@ -1021,7 +1017,7 @@ void usage(std::ostream& os, std::filesystem::path const& progname) { << " [options]\n\n" << "DWARFS options:\n" << " -o cachesize=SIZE set size of block cache (512M)\n" - << " -o blocksize=SIZE set file block size\n" + << " -o blocksize=SIZE set file I/O block size (512K)\n" << " -o readahead=SIZE set readahead size (0)\n" << " -o workers=NUM number of worker threads (2)\n" << " -o mlock=NAME mlock mode: (none), try, must\n"