summaryrefslogtreecommitdiff
path: root/drivers/md/dm-bufio.c
diff options
context:
space:
mode:
authorBlagovest Kolenichev <bkolenichev@codeaurora.org>2018-07-11 08:31:19 -0700
committerSrinivasarao P <spathi@codeaurora.org>2018-07-18 15:09:28 +0530
commitdf1c139ee74a8c6a2bc35112d02f32ef654dfafb (patch)
tree717137876588d24f052118821afc6e6b4cd1d8ec /drivers/md/dm-bufio.c
parent4049db73f1a32cd633827f479cb25fdcd231d7f4 (diff)
parent789274d6967db4c8eeba291dc618c84698dc9803 (diff)
Merge android-4.4.140 (789274d) into msm-4.4
* refs/heads/tmp-789274d Linux 4.4.140 staging: comedi: quatech_daqp_cs: fix no-op loop daqp_ao_insn_write() netfilter: nf_log: don't hold nf_log_mutex during user access mtd: cfi_cmdset_0002: Change erase functions to check chip good only mtd: cfi_cmdset_0002: Change erase functions to retry for error mtd: cfi_cmdset_0002: Change definition naming to retry write operation dm bufio: don't take the lock in dm_bufio_shrink_count mtd: rawnand: mxc: set spare area size register explicitly dm bufio: drop the lock when doing GFP_NOIO allocation dm bufio: avoid sleeping while holding the dm_bufio lock mm, page_alloc: do not break __GFP_THISNODE by zonelist reset media: cx25840: Use subdev host data for PLL override x86/mce: Fix incorrect "Machine check from unknown source" message x86/mce: Detect local MCEs properly HID: debug: check length before copy_to_user() HID: hiddev: fix potential Spectre v1 HID: i2c-hid: Fix "incomplete report" noise ext4: check superblock mapped prior to committing ext4: add more mount time checks of the superblock ext4: add more inode number paranoia checks ext4: clear i_data in ext4_inode_info when removing inline data ext4: include the illegal physical block in the bad map ext4_error msg ext4: verify the depth of extent tree in ext4_find_extent() ext4: only look at the bg_flags field if it is valid ext4: always check block group bounds in ext4_init_block_bitmap() ext4: make sure bitmaps and the inode table don't overlap with bg descriptors jbd2: don't mark block as modified if the handle is out of credits cifs: Fix infinite loop when using hard mount option drbd: fix access after free s390: Correct register corruption in critical section cleanup scsi: sg: mitigate read/write abuse tracing: Fix missing return symbol in function_graph output mm: hugetlb: yield when prepping struct pages ubi: fastmap: Correctly handle interrupted erasures in EBA ARM: dts: imx6q: Use correct SDMA script for SPI5 core netfilter: nf_tables: use WARN_ON_ONCE instead of BUG_ON in nft_do_chain() nvme-pci: initialize queue memory before interrupts kprobes/x86: Do not modify singlestep buffer while resuming ipv4: Fix error return value in fib_convert_metrics() i2c: rcar: fix resume by always initializing registers before transfer ath10k: fix rfc1042 header retrieval in QCA4019 with eth decap mode x86/boot: Fix early command-line parsing when matching at end n_tty: Access echo_* variables carefully. staging: android: ion: Return an ERR_PTR in ion_map_kernel n_tty: Fix stall at n_tty_receive_char_special(). USB: serial: cp210x: add Silicon Labs IDs for Windows Update USB: serial: cp210x: add CESINEL device ids usb: cdc_acm: Add quirk for Uniden UBC125 scanner Change-Id: I01c4fc4b6354c28a7d8ff391ff515096ed4d3da4 Signed-off-by: Blagovest Kolenichev <bkolenichev@codeaurora.org> Signed-off-by: Srinivasarao P <spathi@codeaurora.org>
Diffstat (limited to 'drivers/md/dm-bufio.c')
-rw-r--r--drivers/md/dm-bufio.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c
index d566c32e222a..b1d5fa0bc8f7 100644
--- a/drivers/md/dm-bufio.c
+++ b/drivers/md/dm-bufio.c
@@ -813,6 +813,7 @@ enum new_flag {
static struct dm_buffer *__alloc_buffer_wait_no_callback(struct dm_bufio_client *c, enum new_flag nf)
{
struct dm_buffer *b;
+ bool tried_noio_alloc = false;
/*
* dm-bufio is resistant to allocation failures (it just keeps
@@ -837,6 +838,15 @@ static struct dm_buffer *__alloc_buffer_wait_no_callback(struct dm_bufio_client
if (nf == NF_PREFETCH)
return NULL;
+ if (dm_bufio_cache_size_latch != 1 && !tried_noio_alloc) {
+ dm_bufio_unlock(c);
+ b = alloc_buffer(c, GFP_NOIO | __GFP_NORETRY | __GFP_NOMEMALLOC | __GFP_NOWARN);
+ dm_bufio_lock(c);
+ if (b)
+ return b;
+ tried_noio_alloc = true;
+ }
+
if (!list_empty(&c->reserved_buffers)) {
b = list_entry(c->reserved_buffers.next,
struct dm_buffer, lru_list);
@@ -1564,19 +1574,11 @@ dm_bufio_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
static unsigned long
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)
- dm_bufio_lock(c);
- else if (!dm_bufio_trylock(c))
- return 0;
+ struct dm_bufio_client *c = container_of(shrink, struct dm_bufio_client, shrinker);
+ unsigned long count = READ_ONCE(c->n_buffers[LIST_CLEAN]) +
+ READ_ONCE(c->n_buffers[LIST_DIRTY]);
+ unsigned long retain_target = get_retain_buffers(c);
- count = c->n_buffers[LIST_CLEAN] + c->n_buffers[LIST_DIRTY];
- retain_target = get_retain_buffers(c);
- dm_bufio_unlock(c);
return (count < retain_target) ? 0 : (count - retain_target);
}