Subject: [PATCH] reiserfsprogs: Warn on block sizes > 4k From: Jeff Mahoney Filesystems created with block size > page size will not work until that support is added to the kernel. Filesystems with block size > 4k (lowest page size supported in Linux) will not work on all systems. This patch adds a check and a warning in those conditions, informing the user of the caveats of using a larger block size. It can be overridden with -f. --- include/reiserfs_lib.h | 1 + mkreiserfs/mkreiserfs.c | 3 +++ reiserfscore/reiserfslib.c | 18 ++++++++++++++++++ 3 files changed, 22 insertions(+) --- a/include/reiserfs_lib.h 2004-10-01 12:19:34.000000000 -0400 +++ b/include/reiserfs_lib.h 2008-03-23 22:07:01.000000000 -0400 @@ -92,6 +92,7 @@ void reiserfs_read_bitmap_blocks (reiser void reiserfs_free_bitmap_blocks (reiserfs_filsys_t *); */ int no_reiserfs_found (reiserfs_filsys_t *); +int block_size_ok(int blocksize, int force); int is_block_count_correct (unsigned long block_of_super_block, unsigned int block_size, unsigned long block_count, unsigned long journal_size); //unsigned long min_block_amount (int block_size, unsigned long journal_size); --- a/mkreiserfs/mkreiserfs.c 2008-03-23 22:05:33.000000000 -0400 +++ b/mkreiserfs/mkreiserfs.c 2008-03-23 22:05:34.000000000 -0400 @@ -686,6 +686,9 @@ int main (int argc, char **argv) if (!(mode & QUIET_MODE) && !can_we_format_it (device_name, force)) return 1; + + if (!(mode & QUIET_MODE) && !block_size_ok (Block_size, force)) + return 1; if (jdevice_name) if (!(mode & QUIET_MODE) && !can_we_format_it (jdevice_name, force)) --- a/reiserfscore/reiserfslib.c 2004-10-04 16:39:35.000000000 -0400 +++ b/reiserfscore/reiserfslib.c 2008-03-23 22:05:34.000000000 -0400 @@ -1175,6 +1175,24 @@ void make_sure_root_dir_exists (reiserfs &parent_root_dir_key, ih_flags); } +int block_size_ok (int blocksize, int force) +{ + int pagesize = getpagesize(); + if (blocksize > 4096) { + reiserfs_warning (stderr, "Block sizes larger than 4k are not " + "supported on all architectures.\n"); + if (blocksize > pagesize) + reiserfs_warning (stderr, "The newly created filesystem will not " + "be mountable on this system.\n"); + else + reiserfs_warning (stderr, "The newly created filesystem may not " + "be mountable on other systems.\n"); + check_forcing_ask_confirmation (force); + } + + return 1; +} + /* we only can use a file for filesystem or journal if it is either not mounted block device or regular file and we are forced to use it */