From 134b450cb65b1986c78e0b292cff78c2f1882a2b Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Thu, 24 Apr 2014 17:44:14 +0200 Subject: ext2fs: cache the superblock 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. --- ext2fs/ext2fs.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'ext2fs/ext2fs.h') diff --git a/ext2fs/ext2fs.h b/ext2fs/ext2fs.h index e01d1a59..3422af2f 100644 --- a/ext2fs/ext2fs.h +++ b/ext2fs/ext2fs.h @@ -297,10 +297,14 @@ unsigned log2_stat_blocks_per_fs_block; /* A handy page of page-aligned zeros. */ vm_address_t zeroblock; -/* Get the superblock from the disk, & setup various global info from it. */ +/* Get the superblock from the disk, point `sblock' to it, and setup + various global info from it. */ void get_hypermetadata (); -/* Map `sblock' and `group_desc_image' pointers to disk cache. */ +/* Map `group_desc_image' pointers to disk cache. Also, establish a + non-exported mapping to the superblock that will be used by + diskfs_set_hypermetadata to update the superblock from the cache + `sblock' points to. */ void map_hypermetadata (); /* ---------------------------------------------------------------- */ -- cgit v1.2.3