ebpf
raid
raid5
The Berkeley Packet Filter is a technology used in certain computer operating systems for programs that need to, among other things, analyze network traffic. It provides a raw interface to data link layers, permitting raw link-layer packets to be sent and received. It is available on most Unix-like operating systems.
BPF Compiler Collection (BCC). BCC is a toolkit for creating efficient kernel tracing and manipulation programs
references:
md_make_request
The example demonstrate how to trace bio (block device IO)
RAID ("Redundant Array of Inexpensive Disks" or "Redundant Array of Independent Disks") is a data storage virtualization technology that combines multiple physical disk drive components into one or more logical units for the purposes of data redundancy, performance improvement, or both.
There are different type of RAID:
RAID-N, where N is a number presenting different usage. e.g: RAID1, RAID0, RAID5 โฆ etc
RAID-AB, where A, B are number, A stands for buttom
and B for top
Special, eg. JBOD, SHR (synology hybrid RAID)
RAID5 use XOR to ensure parity.
Take the picture above for example. There are five disk, and the last one is responsible for parity. The red one is broken but it can be recovered with parity and the others block. 1(parity) 1(block1) ^ 0(block2) ^ 1(block4) = 1(block3)
And the distribution of RAID5 could be different, for example
Left symmetric
Right symmetric
struct stripe_head
in the basic unit of IO handleraid5_make_request
handle_active_stripes
: handle the stripes data, which calls handle_stripe
which calls raid_run_ops
, ops_run_io
raid_run_ops
: is for check parity blockops_run_io
: submit request to diskHere are some references:
So, according to the examples above.
Now, what if we know there is a call name ops_run_io
, and the structure defined in linux source code is struct sh
.
How can we start to conduct a related experient?
linux/drivers/md/raid5.h
Q: How does raid request works in linux kernel?
A:
Q: Where to find codes related to raid
?
A: linux-4.4.x/drivers/md
, where you can see raid5.h
Q: How to start?
A: Think like this,
kprobe
to ops_run_io
Tip: user kobject.