mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +03:00
Implement uncached prefetch
Previously the primarycache property was handled only in the dbuf layer. Since the speculative prefetcher is implemented in the ARC, it had to be disabled for uncacheable buffers. This change gives the ARC knowledge about uncacheable buffers via arc_read() and arc_write(). So when remove_reference() drops the last reference on the ARC header, it can either immediately destroy it, or if it is marked as prefetch, put it into a new arc_uncached state. That state is scanned every second, evicting stale buffers that were not demand read. This change also tracks dbufs that were read from the beginning, but not to the end. It is assumed that such buffers may receive further reads, and so they are stored in dbuf cache. If a following reads reaches the end of the buffer, it is immediately evicted. Otherwise it will follow regular dbuf cache eviction. Since the dbuf layer does not know actual file sizes, this logic is not applied to the final buffer of a dnode. Since uncacheable buffers should no longer stay in the ARC for long, this patch also tries to optimize I/O by allocating ARC physical buffers as linear to allow buffer sharing. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: George Wilson <george.wilson@delphix.com> Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Signed-off-by: Alexander Motin <mav@FreeBSD.org> Sponsored by: iXsystems, Inc. Closes #14243
This commit is contained in:
@@ -55,6 +55,8 @@ extern "C" {
|
||||
#define DB_RF_NEVERWAIT (1 << 4)
|
||||
#define DB_RF_CACHED (1 << 5)
|
||||
#define DB_RF_NO_DECRYPT (1 << 6)
|
||||
#define DB_RF_PARTIAL_FIRST (1 << 7)
|
||||
#define DB_RF_PARTIAL_MORE (1 << 8)
|
||||
|
||||
/*
|
||||
* The simplified state transition diagram for dbufs looks like:
|
||||
@@ -321,6 +323,9 @@ typedef struct dmu_buf_impl {
|
||||
uint8_t db_pending_evict;
|
||||
|
||||
uint8_t db_dirtycnt;
|
||||
|
||||
/* The buffer was partially read. More reads may follow. */
|
||||
uint8_t db_partial_read;
|
||||
} dmu_buf_impl_t;
|
||||
|
||||
#define DBUF_HASH_MUTEX(h, idx) \
|
||||
|
||||
Reference in New Issue
Block a user