summaryrefslogtreecommitdiff
path: root/drivers/md
diff options
context:
space:
mode:
authorAlex Shi <alex.shi@linaro.org>2018-01-18 12:02:00 +0800
committerAlex Shi <alex.shi@linaro.org>2018-01-18 12:02:00 +0800
commit13b48cd3ac945d4e4075bec53f107a315fe771ae (patch)
treee8987fa4d024e61e1f10edd2972f5edefb7324af /drivers/md
parent921884d92b8735f14cface97eb53536cd8ac6108 (diff)
parent42375c1120d5c90d7469ba264fb124f728b1a4f7 (diff)
Merge tag 'v4.4.112' into linux-linaro-lsk-v4.4
This is the 4.4.112 stable release
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);
}
/*