diff options
author | Matthew Ahrens <[email protected]> | 2015-12-26 22:10:31 +0100 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2016-01-12 09:02:33 -0800 |
commit | 7f60329a261bd48558a498fb10e9b29638eab33b (patch) | |
tree | 5e6616fbac91442ce424ca44a8288bf9f46db3cc /include | |
parent | ab5cbbd1078bf007b50b084bb31fd58c7c5652f4 (diff) |
Illumos 5987 - zfs prefetch code needs work
5987 zfs prefetch code needs work
Reviewed by: Adam Leventhal <[email protected]>
Reviewed by: George Wilson <[email protected]>
Reviewed by: Paul Dagnelie <[email protected]>
Approved by: Gordon Ross <[email protected]>
References:
https://www.illumos.org/issues/5987 zfs prefetch code needs work
illumos/illumos-gate@cf6106c 5987 zfs prefetch code needs work
Porting notes:
- [module/zfs/dbuf.c]
- 5f6d0b6 Handle block pointers with a corrupt logical size
- [module/zfs/dmu_zfetch.c]
- c65aa5b Fix gcc missing parenthesis warnings
- 428870f Update core ZFS code from build 121 to build 141.
- 79c76d5 Change KM_PUSHPAGE -> KM_SLEEP
- b8d06fc Switch KM_SLEEP to KM_PUSHPAGE
- Account for ISO C90 - mixed declarations and code - warnings
- Module parameters (new/changed):
- Replaced zfetch_block_cap with zfetch_max_distance
(Max bytes to prefetch per stream (default 8MB; 8 * 1024 * 1024))
- Preserved zfs_prefetch_disable as 'int' for consistency with
existing Linux module options.
- [include/sys/trace_arc.h]
- Added new tracepoints
- DEFINE_ARC_BUF_HDR_EVENT(zfs_arc__sync__wait__for__async);
- DEFINE_ARC_BUF_HDR_EVENT(zfs_arc__demand__hit__predictive__prefetch);
- [man/man5/zfs-module-parameters.5]
- Updated man page
Ported-by: kernelOfTruth [email protected]
Signed-off-by: Brian Behlendorf <[email protected]>
Diffstat (limited to 'include')
-rw-r--r-- | include/sys/arc.h | 28 | ||||
-rw-r--r-- | include/sys/dmu.h | 3 | ||||
-rw-r--r-- | include/sys/dmu_zfetch.h | 37 | ||||
-rw-r--r-- | include/sys/trace_arc.h | 2 |
4 files changed, 35 insertions, 35 deletions
diff --git a/include/sys/arc.h b/include/sys/arc.h index db7a64aa2..5780554b5 100644 --- a/include/sys/arc.h +++ b/include/sys/arc.h @@ -84,27 +84,31 @@ typedef enum arc_flags ARC_FLAG_CACHED = 1 << 4, /* I/O was in cache */ ARC_FLAG_L2CACHE = 1 << 5, /* cache in L2ARC */ ARC_FLAG_L2COMPRESS = 1 << 6, /* compress in L2ARC */ + ARC_FLAG_PREDICTIVE_PREFETCH = 1 << 7, /* I/O from zfetch */ /* * Private ARC flags. These flags are private ARC only flags that * will show up in b_flags in the arc_hdr_buf_t. These flags should * only be set by ARC code. */ - ARC_FLAG_IN_HASH_TABLE = 1 << 7, /* buffer is hashed */ - ARC_FLAG_IO_IN_PROGRESS = 1 << 8, /* I/O in progress */ - ARC_FLAG_IO_ERROR = 1 << 9, /* I/O failed for buf */ - ARC_FLAG_FREED_IN_READ = 1 << 10, /* freed during read */ - ARC_FLAG_BUF_AVAILABLE = 1 << 11, /* block not in use */ - ARC_FLAG_INDIRECT = 1 << 12, /* indirect block */ - ARC_FLAG_L2_WRITING = 1 << 13, /* write in progress */ - ARC_FLAG_L2_EVICTED = 1 << 14, /* evicted during I/O */ - ARC_FLAG_L2_WRITE_HEAD = 1 << 15, /* head of write list */ + ARC_FLAG_IN_HASH_TABLE = 1 << 8, /* buffer is hashed */ + ARC_FLAG_IO_IN_PROGRESS = 1 << 9, /* I/O in progress */ + ARC_FLAG_IO_ERROR = 1 << 10, /* I/O failed for buf */ + ARC_FLAG_FREED_IN_READ = 1 << 11, /* freed during read */ + ARC_FLAG_BUF_AVAILABLE = 1 << 12, /* block not in use */ + ARC_FLAG_INDIRECT = 1 << 13, /* indirect block */ + /* Indicates that block was read with ASYNC priority. */ + ARC_FLAG_PRIO_ASYNC_READ = 1 << 14, + ARC_FLAG_L2_WRITING = 1 << 15, /* write in progress */ + ARC_FLAG_L2_EVICTED = 1 << 16, /* evicted during I/O */ + ARC_FLAG_L2_WRITE_HEAD = 1 << 17, /* head of write list */ /* indicates that the buffer contains metadata (otherwise, data) */ - ARC_FLAG_BUFC_METADATA = 1 << 16, + ARC_FLAG_BUFC_METADATA = 1 << 18, /* Flags specifying whether optional hdr struct fields are defined */ - ARC_FLAG_HAS_L1HDR = 1 << 17, - ARC_FLAG_HAS_L2HDR = 1 << 18, + ARC_FLAG_HAS_L1HDR = 1 << 19, + ARC_FLAG_HAS_L2HDR = 1 << 20, + } arc_flags_t; struct arc_buf { diff --git a/include/sys/dmu.h b/include/sys/dmu.h index 75d85951a..0a5b2809b 100644 --- a/include/sys/dmu.h +++ b/include/sys/dmu.h @@ -487,7 +487,8 @@ uint64_t dmu_buf_refcount(dmu_buf_t *db); * individually with dmu_buf_rele. */ int dmu_buf_hold_array_by_bonus(dmu_buf_t *db, uint64_t offset, - uint64_t length, int read, void *tag, int *numbufsp, dmu_buf_t ***dbpp); + uint64_t length, boolean_t read, void *tag, + int *numbufsp, dmu_buf_t ***dbpp); void dmu_buf_rele_array(dmu_buf_t **, int numbufs, void *tag); typedef void dmu_buf_evict_func_t(void *user_ptr); diff --git a/include/sys/dmu_zfetch.h b/include/sys/dmu_zfetch.h index 38ed1d872..df33f182b 100644 --- a/include/sys/dmu_zfetch.h +++ b/include/sys/dmu_zfetch.h @@ -23,8 +23,12 @@ * Use is subject to license terms. */ -#ifndef _DFETCH_H -#define _DFETCH_H +/* + * Copyright (c) 2014 by Delphix. All rights reserved. + */ + +#ifndef _DMU_ZFETCH_H +#define _DMU_ZFETCH_H #include <sys/zfs_context.h> @@ -36,41 +40,30 @@ extern unsigned long zfetch_array_rd_sz; struct dnode; /* so we can reference dnode */ -typedef enum zfetch_dirn { - ZFETCH_FORWARD = 1, /* prefetch increasing block numbers */ - ZFETCH_BACKWARD = -1 /* prefetch decreasing block numbers */ -} zfetch_dirn_t; - typedef struct zstream { - uint64_t zst_offset; /* offset of starting block in range */ - uint64_t zst_len; /* length of range, in blocks */ - zfetch_dirn_t zst_direction; /* direction of prefetch */ - uint64_t zst_stride; /* length of stride, in blocks */ - uint64_t zst_ph_offset; /* prefetch offset, in blocks */ - uint64_t zst_cap; /* prefetch limit (cap), in blocks */ - kmutex_t zst_lock; /* protects stream */ - clock_t zst_last; /* lbolt of last prefetch */ - list_node_t zst_node; /* next zstream here */ + uint64_t zs_blkid; /* expect next access at this blkid */ + uint64_t zs_pf_blkid; /* next block to prefetch */ + kmutex_t zs_lock; /* protects stream */ + hrtime_t zs_atime; /* time last prefetch issued */ + list_node_t zs_node; /* link for zf_stream */ } zstream_t; typedef struct zfetch { krwlock_t zf_rwlock; /* protects zfetch structure */ - list_t zf_stream; /* AVL tree of zstream_t's */ + list_t zf_stream; /* list of zstream_t's */ struct dnode *zf_dnode; /* dnode that owns this zfetch */ - uint32_t zf_stream_cnt; /* # of active streams */ - uint64_t zf_alloc_fail; /* # of failed attempts to alloc strm */ } zfetch_t; void zfetch_init(void); void zfetch_fini(void); void dmu_zfetch_init(zfetch_t *, struct dnode *); -void dmu_zfetch_rele(zfetch_t *); -void dmu_zfetch(zfetch_t *, uint64_t, uint64_t, int); +void dmu_zfetch_fini(zfetch_t *); +void dmu_zfetch(zfetch_t *, uint64_t, uint64_t); #ifdef __cplusplus } #endif -#endif /* _DFETCH_H */ +#endif /* _DMU_ZFETCH_H */ diff --git a/include/sys/trace_arc.h b/include/sys/trace_arc.h index 31c3cdcb9..55dbdf19b 100644 --- a/include/sys/trace_arc.h +++ b/include/sys/trace_arc.h @@ -102,6 +102,8 @@ DEFINE_ARC_BUF_HDR_EVENT(zfs_arc__evict); DEFINE_ARC_BUF_HDR_EVENT(zfs_arc__delete); DEFINE_ARC_BUF_HDR_EVENT(zfs_new_state__mru); DEFINE_ARC_BUF_HDR_EVENT(zfs_new_state__mfu); +DEFINE_ARC_BUF_HDR_EVENT(zfs_arc__sync__wait__for__async); +DEFINE_ARC_BUF_HDR_EVENT(zfs_arc__demand__hit__predictive__prefetch); DEFINE_ARC_BUF_HDR_EVENT(zfs_l2arc__hit); DEFINE_ARC_BUF_HDR_EVENT(zfs_l2arc__miss); |