X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=module%2Fzfs%2Fdbuf.c;fp=module%2Fzfs%2Fdbuf.c;h=205abaada491ecdc1b9ef0e77d057573a19967ff;hb=1eb5bfa3dcdaecb19543d9df13131374a7a42947;hp=99f728f4b76eaeea73f69709dccc0ac6efcf9d30;hpb=753c38392ddff9d3cf140bb4d28f3bfba52c92d2;p=zfs.git diff --git a/module/zfs/dbuf.c b/module/zfs/dbuf.c index 99f728f..205abaa 100644 --- a/module/zfs/dbuf.c +++ b/module/zfs/dbuf.c @@ -2189,7 +2189,24 @@ dbuf_rele_and_unlock(dmu_buf_impl_t *db, void *tag) dbuf_evict(db); } else { VERIFY(arc_buf_remove_ref(db->db_buf, db) == 0); - if (!DBUF_IS_CACHEABLE(db)) + + /* + * A dbuf will be eligible for eviction if either the + * 'primarycache' property is set or a duplicate + * copy of this buffer is already cached in the arc. + * + * In the case of the 'primarycache' a buffer + * is considered for eviction if it matches the + * criteria set in the property. + * + * To decide if our buffer is considered a + * duplicate, we must call into the arc to determine + * if multiple buffers are referencing the same + * block on-disk. If so, then we simply evict + * ourselves. + */ + if (!DBUF_IS_CACHEABLE(db) || + arc_buf_eviction_needed(db->db_buf)) dbuf_clear(db); else mutex_exit(&db->db_mtx);