diff options
author | Lars Ellenberg <lars.ellenberg@linbit.com> | 2013-03-22 22:17:36 -0600 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2013-03-22 22:17:36 -0600 |
commit | cbe5e6109538ddab57764a88d9f0c2accd0c7d48 (patch) | |
tree | e09809862b9be7a44b44aa7367d470da14b2ccf0 /include/linux/lru_cache.h | |
parent | 779b3fe4c0e9dea19ae3ddef0b5fd1a663b63ee6 (diff) | |
download | op-kernel-dev-cbe5e6109538ddab57764a88d9f0c2accd0c7d48.zip op-kernel-dev-cbe5e6109538ddab57764a88d9f0c2accd0c7d48.tar.gz |
lru_cache: introduce lc_get_cumulative()
New helper to be able to consolidate more updates
into a single transaction.
Without this, we can only grab a single refcount
on an updated element while preparing a transaction.
lc_get_cumulative - like lc_get; also finds to-be-changed elements
@lc: the lru cache to operate on
@enr: the label to look up
Unlike lc_get this also returns the element for @enr, if it is belonging to
a pending transaction, so the return values are like for lc_get(),
plus:
pointer to an element already on the "to_be_changed" list.
In this case, the cache was already marked %LC_DIRTY.
Caller needs to make sure that the pending transaction is completed,
before proceeding to actually use this element.
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Fixed up by Jens to export lc_get_cumulative().
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/linux/lru_cache.h')
-rw-r--r-- | include/linux/lru_cache.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/lru_cache.h b/include/linux/lru_cache.h index 4019013..4626228 100644 --- a/include/linux/lru_cache.h +++ b/include/linux/lru_cache.h @@ -256,6 +256,7 @@ extern void lc_destroy(struct lru_cache *lc); extern void lc_set(struct lru_cache *lc, unsigned int enr, int index); extern void lc_del(struct lru_cache *lc, struct lc_element *element); +extern struct lc_element *lc_get_cumulative(struct lru_cache *lc, unsigned int enr); extern struct lc_element *lc_try_get(struct lru_cache *lc, unsigned int enr); extern struct lc_element *lc_find(struct lru_cache *lc, unsigned int enr); extern struct lc_element *lc_get(struct lru_cache *lc, unsigned int enr); |