prefetch btree nodes when walking a tree
This commit is contained in:
		| @@ -55,11 +55,6 @@ namespace persistent_data { | ||||
| 			      unsigned max_concurrent_locks, | ||||
| 			      mode m); | ||||
|  | ||||
| 		enum block_type { | ||||
| 			BT_SUPERBLOCK, | ||||
| 			BT_NORMAL | ||||
| 		}; | ||||
|  | ||||
| 		typedef void (*put_behaviour_fn)(block_cache &, block_cache::block &); | ||||
|  | ||||
| 		class read_ref { | ||||
| @@ -142,6 +137,7 @@ namespace persistent_data { | ||||
|  | ||||
| 		block_address get_nr_blocks() const; | ||||
|  | ||||
| 		void prefetch(block_address b) const; | ||||
| 		void flush() const; | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -270,6 +270,13 @@ namespace persistent_data { | ||||
| 		return bc_.get_nr_blocks(); | ||||
| 	} | ||||
|  | ||||
| 	template <uint32_t BlockSize> | ||||
| 	void | ||||
| 	block_manager<BlockSize>::prefetch(block_address b) const | ||||
| 	{ | ||||
| 		bc_.prefetch(b); | ||||
| 	} | ||||
|  | ||||
| 	template <uint32_t BlockSize> | ||||
| 	void | ||||
| 	block_manager<BlockSize>::flush() const | ||||
|   | ||||
| @@ -827,7 +827,10 @@ namespace persistent_data { | ||||
|  | ||||
| 		// FIXME: use a switch statement | ||||
| 		if (o.get_type() == INTERNAL) { | ||||
| 			if (v.visit_internal(loc, o)) | ||||
| 			if (v.visit_internal(loc, o)) { | ||||
| 				for (unsigned i = 0; i < o.get_nr_entries(); i++) | ||||
| 					tm_->prefetch(o.value_at(i)); | ||||
|  | ||||
| 				for (unsigned i = 0; i < o.get_nr_entries(); i++) { | ||||
| 					node_location loc2(loc); | ||||
|  | ||||
| @@ -836,6 +839,7 @@ namespace persistent_data { | ||||
|  | ||||
| 					walk_tree(v, loc2, o.value_at(i)); | ||||
| 				} | ||||
| 			} | ||||
|  | ||||
| 		} else if (loc.path.size() < Levels - 1) { | ||||
| 			if (v.visit_internal_leaf(loc, o)) | ||||
|   | ||||
| @@ -66,6 +66,10 @@ namespace persistent_data { | ||||
| 			return bm_; | ||||
| 		} | ||||
|  | ||||
| 		void prefetch(block_address b) { | ||||
| 			bm_->prefetch(b); | ||||
| 		} | ||||
|  | ||||
| 	private: | ||||
| 		void add_shadow(block_address b); | ||||
| 		void remove_shadow(block_address b); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user