Project

General

Profile

Bug #7915

checks in l2arc_evict could use some cleaning up

Added by Andriy Gapon almost 4 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
zfs - Zettabyte File System
Start date:
2017-02-28
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:

Description

l2arc_evict() is strictly serialized with respect to l2arc_write_buffers() and l2arc_write_done().
Normally, l2arc_evict() and l2arc_write_buffers() are called from the same thread, so they can not be concurrent.
Also, l2arc_write_buffers() uses zio_wait() on the parent zio of all cache zio-s.
That ensures that l2arc_write_done() is completed before l2arc_write_buffers() returns.

Finally, if a cache device is removed, then l2arc_evict() is called under SCL_ALL in the exclusive mode.
That ensures that it can not be concurrent with the normal L2ARC accesses to the device (including writing and evicting buffers).

Given the above, some checks and actions in l2arc_evict() do not make sense.
For instance, it must never encounter the write head header let alone remove it from the buffer list.

Also available in: Atom PDF