diff --git a/ext/extfs.cpp b/ext/extfs.cpp index 560134e4..99680279 100644 --- a/ext/extfs.cpp +++ b/ext/extfs.cpp @@ -123,7 +123,8 @@ void StatInode(Inode* inode, struct stat* st) st->st_mtim.tv_sec = inode->data->i_mtime; st->st_mtim.tv_nsec = 0; st->st_blksize = inode->filesystem->block_size; - st->st_blocks = inode->data->i_blocks; + st->st_blocks = ((uint64_t) inode->data->i_blocks * + (uint64_t) inode->filesystem->block_size) / 512; } static void compact_arguments(int* argc, char*** argv) diff --git a/kernel/fs/full.cpp b/kernel/fs/full.cpp index 64a5a63d..170b4a23 100644 --- a/kernel/fs/full.cpp +++ b/kernel/fs/full.cpp @@ -44,7 +44,6 @@ Full::Full(dev_t dev, ino_t ino, uid_t owner, gid_t group, mode_t mode) this->stat_gid = group; this->stat_mode = (mode & S_SETABLE) | this->type; this->stat_size = 0; - this->stat_blksize = 1; this->dev = dev; this->ino = ino; } diff --git a/kernel/fs/kram.cpp b/kernel/fs/kram.cpp index 80ea554c..0a7f9226 100644 --- a/kernel/fs/kram.cpp +++ b/kernel/fs/kram.cpp @@ -122,7 +122,6 @@ File::File(InodeType inode_type, mode_t type, dev_t dev, ino_t ino, uid_t owner, this->stat_gid = group; this->stat_mode = (mode & S_SETABLE) | this->type; this->stat_size = 0; - this->stat_blksize = 1; this->dev = dev; this->ino = ino; this->supports_iovec = true; diff --git a/kernel/fs/null.cpp b/kernel/fs/null.cpp index 51ef997c..f54c375a 100644 --- a/kernel/fs/null.cpp +++ b/kernel/fs/null.cpp @@ -41,7 +41,6 @@ Null::Null(dev_t dev, ino_t ino, uid_t owner, gid_t group, mode_t mode) this->stat_gid = group; this->stat_mode = (mode & S_SETABLE) | this->type; this->stat_size = 0; - this->stat_blksize = 1; this->dev = dev; this->ino = ino; } diff --git a/kernel/fs/random.cpp b/kernel/fs/random.cpp index b861b7cd..6e8229d5 100644 --- a/kernel/fs/random.cpp +++ b/kernel/fs/random.cpp @@ -44,7 +44,6 @@ DevRandom::DevRandom(dev_t dev, ino_t ino, uid_t owner, gid_t group, this->stat_gid = group; this->stat_mode = (mode & S_SETABLE) | this->type; this->stat_size = 0; - this->stat_blksize = 1; this->dev = dev; this->ino = ino; } diff --git a/kernel/fs/util.cpp b/kernel/fs/util.cpp index 1cb19a80..69fa445c 100644 --- a/kernel/fs/util.cpp +++ b/kernel/fs/util.cpp @@ -46,7 +46,6 @@ UtilMemoryBuffer::UtilMemoryBuffer(dev_t dev, ino_t ino, uid_t owner, this->stat_gid = group; this->type = S_IFREG; this->stat_mode = (mode & S_SETABLE) | this->type; - this->stat_blksize = 1; this->stat_size = bufsize; this->dev = dev; this->ino = ino ? ino : (ino_t) this; diff --git a/kernel/fs/zero.cpp b/kernel/fs/zero.cpp index 10469096..a6cc9b8b 100644 --- a/kernel/fs/zero.cpp +++ b/kernel/fs/zero.cpp @@ -43,7 +43,6 @@ Zero::Zero(dev_t dev, ino_t ino, uid_t owner, gid_t group, mode_t mode) this->stat_gid = group; this->stat_mode = (mode & S_SETABLE) | this->type; this->stat_size = 0; - this->stat_blksize = 1; this->dev = dev; this->ino = ino; } diff --git a/kernel/inode.cpp b/kernel/inode.cpp index 7b14bdf6..439f7091 100644 --- a/kernel/inode.cpp +++ b/kernel/inode.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -50,7 +51,7 @@ AbstractInode::AbstractInode() stat_atim = Time::Get(CLOCK_REALTIME); stat_ctim = Time::Get(CLOCK_REALTIME); stat_mtim = Time::Get(CLOCK_REALTIME); - stat_blksize = 0; + stat_blksize = Page::Size(); stat_blocks = 0; supports_iovec = false; } diff --git a/kernel/partition.cpp b/kernel/partition.cpp index 2e3e81a2..a2847209 100644 --- a/kernel/partition.cpp +++ b/kernel/partition.cpp @@ -119,7 +119,7 @@ int Partition::stat(ioctx_t* ctx, struct stat* st) if ( !ctx->copy_from_src(&myst, st, sizeof(myst)) ) return -1; myst.st_size = length; - myst.st_blocks = length / (myst.st_blksize ? myst.st_blksize : 1); + myst.st_blocks = length / 512; if ( !ctx->copy_to_dest(st, &myst, sizeof(myst)) ) return -1; return 0;