mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-23 19:04:45 +03:00
Linux 3.14 compat: IO acct, global_page_state, etc
generic_start_io_acct/generic_end_io_acct in the master branch of the linux kernel requires that the request_queue be provided. Move the logic from freemem in the spl to arc_free_memory in arc.c. Do this so we can take advantage of global_page_state interface checks in zfs. Upstream kernel replaced struct block_device with struct gendisk in struct bio. Determine if the function bio_set_dev exists during configure and have zfs use that if it exists. bio_set_dev https://github.com/torvalds/linux/commit/74d4699 global_node_page_state https://github.com/torvalds/linux/commit/75ef718 io acct https://github.com/torvalds/linux/commit/d62e26b Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Giuseppe Di Natale <dinatale2@llnl.gov> Closes #6635
This commit is contained in:
committed by
Brian Behlendorf
parent
90cdf2833d
commit
787acae0b5
+20
-2
@@ -4665,6 +4665,24 @@ arc_all_memory(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _KERNEL
|
||||
static uint64_t
|
||||
arc_free_memory(void)
|
||||
{
|
||||
#ifdef ZFS_GLOBAL_NODE_PAGE_STATE
|
||||
return (nr_free_pages() +
|
||||
global_node_page_state(NR_INACTIVE_FILE) +
|
||||
global_node_page_state(NR_INACTIVE_ANON) +
|
||||
global_node_page_state(NR_SLAB_RECLAIMABLE));
|
||||
#else
|
||||
return (nr_free_pages() +
|
||||
global_page_state(NR_INACTIVE_FILE) +
|
||||
global_page_state(NR_INACTIVE_ANON) +
|
||||
global_page_state(NR_SLAB_RECLAIMABLE));
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
typedef enum free_memory_reason_t {
|
||||
FMR_UNKNOWN,
|
||||
FMR_NEEDFREE,
|
||||
@@ -4701,7 +4719,7 @@ arc_available_memory(void)
|
||||
int64_t lowest = INT64_MAX;
|
||||
free_memory_reason_t r = FMR_UNKNOWN;
|
||||
#ifdef _KERNEL
|
||||
uint64_t available_memory = ptob(freemem);
|
||||
uint64_t available_memory = ptob(arc_free_memory());
|
||||
int64_t n;
|
||||
#ifdef __linux__
|
||||
pgcnt_t needfree = btop(arc_need_free);
|
||||
@@ -6904,7 +6922,7 @@ static int
|
||||
arc_memory_throttle(uint64_t reserve, uint64_t txg)
|
||||
{
|
||||
#ifdef _KERNEL
|
||||
uint64_t available_memory = ptob(freemem);
|
||||
uint64_t available_memory = ptob(arc_free_memory());
|
||||
static uint64_t page_load = 0;
|
||||
static uint64_t last_txg = 0;
|
||||
#ifdef __linux__
|
||||
|
||||
Reference in New Issue
Block a user