Skip to content

Instantly share code, notes, and snippets.

@arakashic
arakashic / patch
Last active October 22, 2026 07:30
qzfs-fix
From: Yanfei Guo <yanf.guo@gmail.com>
Subject: [PATCH] QAT: wait for session cleanup without losing operation errors
The QAT driver decrements its pending callback count after invoking the
ZFS completion callback. A waiter can therefore attempt to remove and
free a session while the driver still references it.
Wait for idle sessions where the API supports querying them, and retry
session removal with sleeps and a bounded retry count. Keep cleanup
status separate from the operation result so failures still trigger
@arakashic
arakashic / on-setting-qat-for-zfs.md
Last active September 27, 2026 02:10
On Setting Intel QuickAssist Accelerator for ZFS

I built a TrueNAS storage server with Intel QuickAssist accelerator for ZFS back in 2022. It worked well for me. Since I am upgrading it to TrueNAS 25.04, I had to redo a lot of the past work. So I decided to write down everything. This article is not meant to be a comprehensive guide.

Also, the QAT support in ZFS is mostly a research product. It does not get much maintenance as you can see in git history.

Introduction

The plan was building a TrueNAS storage server, but also using it host various containers and VMs for my services. Essentially, a all-in-one server (or all-in-BOOM if the server fails). Partly because my last NAS had hardware RAID card, and with limited hardware resource in the new server, I was looking at way to offload some ZFS work from the CPU. I did not find any ZFS specific accelerator that I can get cheaply on eBay utill I came across the QZFS paper in USENIX ATC'2019 (https://www.usenix.org/conference/atc19/presentation/hu-xiaokang). It demonstated a way to use the Intel QuickAssis

@arakashic
arakashic / timelib.h
Last active May 26, 2024 22:41
Quick Snip for Time Measurement
#include <time.h>
double TL_gettime();
int TL_checktick();
double TL_gettime()
{
struct timespec t;
clock_gettime(CLOCK_REALTIME, &t);
return ( (double) t.tv_sec + (double) t.tv_nsec * 1.e-9 );