Project

General

Profile

Actions

Submit #2771

closed

[PATCH 2/2] sys/vfs/hammer: make hammer_blockmap_lookup() lightweight

Added by tkusumi almost 10 years ago. Updated almost 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
VFS subsystem
Target version:
-
Start date:
01/16/2015
Due date:
% Done:

0%

Estimated time:

Description

This patch makes a core function hammer_blockmap_lookup() lightweight by splitting it into inlined lookup part and verification part. The problem with current hammer_blockmap_lookup() is that this function really does nothing other than flipping zone bits (blockmap offset translation) when hammer_verify_zone is disabled (set to 0) which is default. It should be inlined to eliminate unnecessary overhead.

It's fairly expensive to call a function with 3 args only to change upper 4 bits of the 64 bits address to a static value 0x2, considering this function is frequently called by hammer_get_buffer() for blockmap offset translation whenever hammer needs a buffer for i/o (except for undo and walking layer1-2) but the buffer isn't cached on the on-memory rbtree.

This patch does the following.
1. Split hammer_blockmap_lookup() into inlined hammer_blockmap_lookup() and hammer_blockmap_lookup_verify()
1-1. hammer_blockmap_lookup() only does bits flipping if hammer_verify_zone is disabled (default)
1-2. hammer_blockmap_lookup() does bits flipping plus blockmap verify by calling hammer_blockmap_lookup_verify() if hammer_veirfy_zone is enabled

There is no logical change here, as it only attempts to reduce unnecessary overhead within core routines. Cloning dragonfly git repository on hammer happens to call hammer_blockmap_lookup() nearly 10000 times with around 37000 files on my environment which is not too small.

This patch goes on top of a cleanup (and obvious) patch I've sent as
[PATCH 1/2] sys/vfs/hammer: make variable names up-to-date with code
since they both changes the same part regarding zone_offset arg.


Files

Actions

Also available in: Atom PDF