summaryrefslogtreecommitdiff
path: root/ext2fs/hyper.c
AgeCommit message (Collapse)Author
2015-12-29fix compiler warnings in hurd/ext2fsFlavio Cruz
ext2fs: Fix compiler warnings. * ext2fs/balloc.c: Use unsigned char instead of char. * ext2fs/bitmap.c Use unsigned char for bitmaps. * ext2fs/dir.c: Fix format. * ext2fs/ext2fs.h: Use unsigned char for bitmaps. * ext2fs/ialloc.c: Use unsigned char for bitmaps. Fix format string in ext2_warning. * ext2fs/pager.c: Fix format string in ext2_warning and ext2_error.
2014-05-13ext2fs: cache the superblockJustus Winter
Previously, the superblock was mmaped and a pointer stored in sblock by map_hypermetadata. This memory is backed by our disk pager. This is rather unfortunate, as this means that whenever we read a value from that location, we might generate a request our disk pager. This amplifies the so-called thread-storm problem. Rather than relying on a mmaped region of memory, just use the data loaded by get_hypermetadata. * ext2fs/hyper.c (get_hypermetadata): Do not free sblock. (mapped_sblock): New variable. (map_hypermetadata): Map the superblock to mapped_sblock instead. (diskfs_set_hypermetadata): Copy superblock into mapped_superblock. * ext2fs/ext2fs.h (get_hypermetadata, map_hypermetadata): Adjust comments accordingly.
2013-09-16Large store support for ext2fsRichard Braun
This is a revised version of the large store patch for ext2fs, written by Ognyan Kulev. It provides support for stores larger than 2 GiB. * ext2fs/balloc.c: Use the new disk_cache_block_ref and disk_cache_block_deref functions to access blocks from the disk cache. * ext2fs/ext2fs.c (main): Update initialization call to pokel_init, and call map_hypermetadata instead of get_hypermetadata. * ext2fs/ext2fs.h: Include <hurd/store.h> and <hurd/ihash.h>. (DISK_CACHE_BLOCKS): New macro. (DC_INCORE): Likewise. (DC_UNTOUCHED): Likewise. (DC_FIXED): Likewise. (DC_DONT_REUSE): Likewise. (DC_NO_BLOCK): Likewise. (DISK_CACHE_LAST_READ_XOR) [!NDEBUG]: Likewise. (struct disk_cache_info): New structure. (disk_cache): New external variable. (disk_cache_size): Likewise. (disk_cache_blocks): Likewise. (disk_cache_bptr): Likewise. (disk_cache_info): Likewise. (disk_cache_lock): Likewise. (disk_cache_reassociation): Likewise. (disk_cache_block_ref): New declaration. (disk_cache_block_ref_ptr): Likewise. (disk_cache_block_deref): Likewise. (disk_cache_block_is_ref): Likewise. (map_hypermetadata): Likewise. (trunc_block): Cast to off_t. (round_block): Likewise. (boffs): Likewise. (bptr_index): New macro. (boffs_ptr): Rewrite as an inline function to make it look up a block from the disk cache. (bptr_offs): Likewise. (dino): Remove function, replaced with ... (dino_ref): ... this one, which adds a reference to the inode block. (dino_deref): New inline function. (record_global_poke): Make sure block is referenced. (record_indir_poke): Likewise. (sync_global_ptr): Remove block reference, and adjust call to pager_sync_some. (sync_global): Add debug call to print wait parameter. * ext2fs/getblk.c: Use the new disk_cache_block_ref and disk_cache_block_deref functions to access blocks from the disk cache. * ext2fs/hyper.c (get_hypermetadata): Read the superblock from the store now that it's not directly mapped in memory. Move the initialization of zeroblock here from ... (map_hypermetadata): ... here. Also, set the superblock pointer. (diskfs_set_hypermetadata): Add a reference to the superblock. (diskfs_readonly_changed): Update call to mprotect. * ext2fs/ialloc.c: Use the new disk_cache_block_ref, disk_cache_block_ref_ptr and disk_cache_block_deref functions to access blocks from the disk cache. * ext2fs/inode.c: Update calls that used the disk image to use the disk cache, and use the new reference handling functions where appropriate. * ext2fs/pager.c: Include <unistd.h> and "../libpager/priv.h". (disk_image): Remove global variable. (disk_pager_read_page): Update cache information. (disk_pager_write_page): Likewise. (disk_pager_notify_evict): New function. (pager_notify_evict): Call disk_pager_notify_evict appropriately. (disk_cache): New global variable. (disk_cache_size): Likewise. (disk_cache_blocks): Likewise. (disk_cache_bptr): Likewise. (disk_cache_info): Likewise. (disk_cache_hint): Likewise. (disk_cache_lock): Likewise. (disk_cache_reassociation): Likewise. (disk_cache_init): New function. (disk_cache_return_unused): Likewise. (disk_cache_block_ref): Likewise. (disk_cache_block_ref_ptr): Likewise. (disk_cache_block_deref): Likewise. (disk_cache_block_is_ref): Likewise. (create_disk_pager): Update initialization of the disk pager. * ext2fs/pokel.c (pokel_add): Drop block references with disk_cache_block_deref. (_pokel_exec): Likewise. * ext2fs/truncate.c (trunc_indirect): Use the new disk_cache_block_ref and disk_cache_block_deref functions to access blocks from the disk cache.
2002-06-022002-05-29 Roland McGrath <roland@frob.com>Roland McGrath
* dir.c (dirscanblock): Use %z format. (diskfs_get_directs): Likewise. * ext2fs.c (main): Likewise. * hyper.c (get_hypermetadata): Likewise. * pager.c (pager_unlock_page): Likewise.
2001-04-012001-03-03 Roland McGrath <roland@frob.com>Roland McGrath
* hyper.c (zeroblock, modified_global_blocks): Remove superfluous zero initializers. (allocate_mod_map): Likewise for static here. (get_hypermetadata): Don't munmap old ZEROBLOCK, just keep it. Allocate ZEROBLOCK with PROT_READ.
2001-01-08doc/Marcus Brinkmann
2001-01-08 Marcus Brinkmann <marcus@gnu.org> * hurd.texi (Store Management): Replace off_t with store_offset_t. (Store I/O): Likewise. (Store Classes): Likewise. ext2fs/ 2001-01-08 Marcus Brinkmann <marcus@gnu.org> * ext2fs.c (main): Use %Ld instead %ld to print store->size. * hyper.c (get_hypermetadata): Likewise. libstore/ 2001-01-08 Marcus Brinkmann <marcus@gnu.org> * zero.c (zero_remap): Change type of variables length, old_length to store_offset_t. (zero_decode): Change type of variable size to store_offset_t. (zero_open): Likewise. Use strtoull instead strtoul to parse size argument from name. Use store_offset_t for max_offs and its calculation. (store_zero_create): Use store_offset_t type for size argument. * derive.c (_store_derive): Use store_offset_t as type for variable last_part_base. * stripe.c (addr_adj): Change types of addr argument and return value to store_offset_t. (store_ileave_create): Change type of interleave argument and variables min_end and end to store_offset_t, but type of variable block_size to size_t. (store_concat_create): Change type of variable block_size to size_t. * make.c (_store_create): Change end argument type to store_offset_t. * store.h: New type store_offset_t, define to off64_t. (struct store_run): Change type of start and length to store_offset_t. (struct store): Change type of end, wrap_src, wrap_dst, blocks, size to store_offset_t. Change type of addr arg in store_read_meth_t and store_write_meth_t to store_offset_t, as well as in declarations for store_read and store_write. Change type of argument end in _store_create declaration to store_offset_t. Change type of argument size in store_zero_create to store_offset_t. Change type of argument interleace in store_ileace_create to store_offset_t. * rdwr.c (store_find_first_run): Change type of return value, addr and *base arguments, and variables wrap_src and run_blocks to store_offset_t. (store_next_run): Change type of *base argument to store_offset_t. (store_write): Change type of addr argument and variable base to store_offset_t. (store_read): Likewise, also for addr argument of local function seg_read. Change type of len argument to size_t. * copy.c (copy_read): Change type of addr argument to store_offset_t. (copy_write): Likewise. * device.c (dev_read): Likewise. (dev_write): Likewise. * file.c (file_read): Likewise. (file_write): Likewise. (file_byte_read): Likewise. (file_byte_write): Likewise. * mvol.c (mvol_read): Likewise. (mvol_write): Likewise. * remap.c (remap_read): Likewise. (remap_write): Likewise. * stripe.c (stripe_read): Likewise. (stripe_write): Likewise. * task.c (task_read): Likewise. (task_write): Likewise. * zero.c (zero_read): Likewise. (zero_write): Likewise. * remap.c (store_remap_runs): Change type of addr and len arguments of local function add_run and of local variables addr, length, baddr, blen and len to store_offset_t. (remap_open): Cast -1 to store_offset_t, not off_t. * argp.c (struct store_parsed): Change type of interleave from off_t to store_offset_t. (store_parsed_append_args): Use %Ld instead %ld to print interleave value. (store_parsed_name): Likewise. ufs/ 2001-01-08 Marcus Brinkmann <marcus@gnu.org> * main.c (main): Use %Ld instead %ld to print store->size. * hyper.c (get_hypermetadata): Likewise. * inode.c (diskfs_S_file_get_storage_info): Change type of variables start and length from off_t to store_offset_t. utils/ 2001-01-08 Marcus Brinkmann <marcus@gnu.org> * storeread.c (main): Change type of addr to store_offset_t, also for first argument of local function dump. Add comment about store->size as len parameter for store_read. Use atoll instead atoi for addr argument. * storeinfo.c (print_store): Remove local function pint, add two similar functions psiz and poff, accepting and printing a size_t or store_offset_t respectively. Use psiz to print block_size, poff to print blocks and size of store. Use %Ld instead %ld to print runs. * storecat.c (main): Change type of addr and left to store_offset_t.
1999-10-071999-10-06 Roland McGrath <roland@baalperazim.frob.com>Roland McGrath
* hyper.c (get_hypermetadata): Avoid overflow in calculation of disk size vs superblock-specified requirement. Add a warning for wasted disk blocks after last filesystem block.
1999-10-031999-10-03 Roland McGrath <roland@baalperazim.frob.com>Roland McGrath
* ext2fs.h (group_desc): Inline function replaced with macro. (group_desc_image): New variable. * hyper.c (get_hypermetadata): Initialize it. * ext2fs.h (sblock_block): Declare new variable. (SBLOCK_LBLOCK): Macro removed. (SBLOCK_OFFS): Define in terms of sblock_block. * ext2fs.c (options): Add --sblock/-S. (parse_opt): Parse it to set sblock_block. * hyper.c (sblock_block): New variable. (get_hypermetadata): Use sblock_block instead of constant SBLOCK_BLOCK. * hyper.c (get_hypermetadata): Use EXT2_MAX_BLOCK_SIZE instead of hard-wired 8192. Don't use ffs to compute log2_block_size, and don't check for the impossible case of non-power-of-two block size (the block size specification we start with is given as a power of two!). * ext2fs.h (block_size): Change type to unsigned int. (BLOCKSIZE_SCALE): Just use SBLOCK->s_log_block_size directly. * hyper.c (get_hypermetadata): Fix printf formats to silence warning. * dir.c (dirscanblock): Likewise.
1999-07-111999-07-11 Roland McGrath <roland@baalperazim.frob.com>Roland McGrath
* dir.c (diskfs_get_directs): Fix sloppy bugs in last change. * hyper.c (allocate_mod_map): Likewise. * pager.c (get_page_buf): Likewise.
1999-07-111999-07-06 Thomas Bushnell, BSG <tb@mit.edu>Thomas Bushnell
* dir.c (diskfs_get_directs): Use mmap instead of vm_allocate. * hyper.c (allocate_mod_map): Likewise. (get_hypermetadata): Likewise. * pager.c (get_page_buf): Likewise. * hyper.c (diskfs_readonly_changed): Use mprotect instead of vm_protect.
1999-07-031999-07-03 Thomas Bushnell, BSG <tb@mit.edu>Thomas Bushnell
* dir.c (diskfs_lookup_hard): Use munmap instead of vm_deallocate. (diskfs_direnter_hard): Likewise. (diskfs_dirremove_hard): Likewise. (diskfs_dirrewrite_hard): Likewise. (diskfs_dirempty): Likewise. (diskfs_drop_dirstat): Likewise. (diskfs_get_directs): Likewise. * hyper.c (allocate_mod_map): Likewise. (get_hypermetadata): Likewise. * pager.c (free_page_buf): Likewise. * truncate.c (poke_pages): Likewise.
1999-06-291999-06-29 Thomas Bushnell, BSG <tb@mit.edu>Thomas Bushnell
* hyper.c (diskfs_readonly_changed): Adjust whether the store should permit writes too.
1999-05-231999-05-23 Roland McGrath <roland@baalperazim.frob.com>Roland McGrath
* ialloc.c (diskfs_alloc_node): Frob printf format to suppress warning. * getblk.c (ext2_getblk): Likewise. * balloc.c (ext2_free_blocks): Likewise. * hyper.c (get_hypermetadata): Likewise.
1996-09-23(diskfs_readonly_changed):Miles Bader
Use STORE->size. (get_hypermetadata): Use STORE->size & STORE->block_size. <hurd/store.h>: New include.
1996-08-15(get_hypermetadata):Miles Bader
Use EXT2_INODE_SIZE instead of sizeof (struct ext2_inode). Deal with various version 2.x features.
1996-08-12*** empty log message ***Thomas Bushnell
1996-06-25(diskfs_readonly_changed): No longer clear the clean bit.Miles Bader
(diskfs_set_hypermetadata): Work correctly.
1996-02-03(get_hypermetadata, diskfs_readonly_changed):Miles Bader
Use ext2_warning to print warnings instead of error().
1996-02-03Fixed handling of the filesystem `clean bit'.Roland McGrath
(ext2fs_clean): New boolean variable. (get_hypermetadata): Set it iff the clean bit is set on entry. If not clean, complain and force read-only. (diskfs_set_hypermetadata): Set clean bit only if ext2fs_clean is set. (diskfs_readonly_changed): Complain if going writable and clean bit clear.
1996-02-03Tue Jan 30 22:25:19 1996 Miles Bader <miles@gnu.ai.mit.edu>Miles Bader
* hyper.c (get_hypermetadata): Don't return any error value, just panic if we can't read the superblock. * ext2fs.c (main): Move warp_inode() inline. Make sure root inode is really there. Don't check return value from get_hypermetadata. (warp_inode): Function removed. * ext2fs.h (get_hypermetadata): Returns void now.
1995-10-20(allocate_mod_map): New function (from get_hypermetadata).Miles Bader
(zeroblock, modified_global_blocks): Define (were common). (diskfs_readonly_changed): New function. (get_hypermetadata): Deallocate ZEROBLOCK if necessary. Use allocate_mod_map to allocate MODIFIED_GLOBAL_BLOCKS. Use diskfs device functions & variables instead of our own.
1995-09-15u32 --> block_tMiles Bader
1995-05-12Change uses of the ext2_{warning,error,panic} functions to not have theMiles Bader
initial function name argument (it's now supplied automagically).
1995-05-09entered into RCSMiles Bader
1995-05-08Formerly hyper.c.~11~Miles Bader
1995-04-21Formerly hyper.c.~10~Miles Bader
1995-04-20Formerly hyper.c.~9~Miles Bader
1995-04-18Formerly hyper.c.~8~Miles Bader
1995-04-17Formerly hyper.c.~7~Miles Bader
1995-04-16Formerly hyper.c.~6~Miles Bader
1995-04-15Formerly hyper.c.~5~Miles Bader
1995-04-13Formerly hyper.c.~4~Miles Bader
1995-04-12Formerly hyper.c.~3~Miles Bader
1995-04-11Formerly hyper.c.~2~Miles Bader
1995-04-11Initial revisionMiles Bader