summaryrefslogtreecommitdiff
path: root/drivers/md
diff options
context:
space:
mode:
authorAmit Pundir <amit.pundir@linaro.org>2018-01-22 11:50:22 +0530
committerAmit Pundir <amit.pundir@linaro.org>2018-01-22 11:50:22 +0530
commit395ae9f4e6934c9f61d7002dc12b267d0c302104 (patch)
treed80d145feb56614796dfe6c2ce41db16b290daf3 /drivers/md
parent317c5652a7c300c2d82ef5bfae8d3558f389d219 (diff)
parent13b48cd3ac945d4e4075bec53f107a315fe771ae (diff)
Merge branch 'linux-linaro-lsk-v4.4' into linux-linaro-lsk-v4.4-android
Signed-off-by: Amit Pundir <amit.pundir@linaro.org> Conflicts: kernel/fork.c Conflict due to Kaiser implementation in LTS 4.4.110. net/ipv4/raw.c Minor conflict due to LTS commit be27b620a861 ("net: ipv4: fix for a race condition in raw_sendmsg")
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm-bufio.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c
index 2ec7f90e3455..969c815c90b6 100644
--- a/drivers/md/dm-bufio.c
+++ b/drivers/md/dm-bufio.c
@@ -1527,7 +1527,8 @@ static unsigned long __scan(struct dm_bufio_client *c, unsigned long nr_to_scan,
int l;
struct dm_buffer *b, *tmp;
unsigned long freed = 0;
- unsigned long count = nr_to_scan;
+ unsigned long count = c->n_buffers[LIST_CLEAN] +
+ c->n_buffers[LIST_DIRTY];
unsigned long retain_target = get_retain_buffers(c);
for (l = 0; l < LIST_SIZE; l++) {
@@ -1564,6 +1565,7 @@ dm_bufio_shrink_count(struct shrinker *shrink, struct shrink_control *sc)
{
struct dm_bufio_client *c;
unsigned long count;
+ unsigned long retain_target;
c = container_of(shrink, struct dm_bufio_client, shrinker);
if (sc->gfp_mask & __GFP_FS)
@@ -1572,8 +1574,9 @@ dm_bufio_shrink_count(struct shrinker *shrink, struct shrink_control *sc)
return 0;
count = c->n_buffers[LIST_CLEAN] + c->n_buffers[LIST_DIRTY];
+ retain_target = get_retain_buffers(c);
dm_bufio_unlock(c);
- return count;
+ return (count < retain_target) ? 0 : (count - retain_target);
}
/*