Skip to content

Commit f9b9856

Browse files
author
Mohan Srinivasan
committed
An uncacheable READ should be served out of the cache when possible.
Summary: Fix for another bug that got introduced during the mergeorama. An uncacheable READ will end up evicting the cached block (cleaning it first if necessary). This should not happen, we should always try and serve the cached block on an uncacheable READ. But a READ miss will go to disk. This bug does not affect correctness, but it could adversely impact cache hit rates. Test Plan: Reviewers: CC: Task ID: # Blame Rev:
1 parent c40f738 commit f9b9856

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/flashcache_main.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2049,8 +2049,13 @@ flashcache_map(struct dm_target *ti, struct bio *bio)
20492049
flashcache_pid_expiry_all_locked(dmc);
20502050
uncacheable = (unlikely(dmc->bypass_cache) ||
20512051
(to_sector(bio->bi_size) != dmc->block_size) ||
2052-
(bio_data_dir(bio) == WRITE && (dmc->cache_mode == FLASHCACHE_WRITE_AROUND)) ||
2053-
flashcache_uncacheable(dmc, bio));
2052+
/*
2053+
* If the op is a READ, we serve it out of cache whenever possible,
2054+
* regardless of cacheablity
2055+
*/
2056+
(bio_data_dir(bio) == WRITE &&
2057+
((dmc->cache_mode == FLASHCACHE_WRITE_AROUND) ||
2058+
flashcache_uncacheable(dmc, bio))));
20542059
spin_unlock_irqrestore(&dmc->ioctl_lock, flags);
20552060
if (uncacheable) {
20562061
flashcache_setlocks_multiget(dmc, bio);

0 commit comments

Comments
 (0)