Skip to content

Commit

Permalink
Merge pull request #35 from akiradeveloper/develop
Browse files Browse the repository at this point in the history
Implement abuse version
  • Loading branch information
akiradeveloper authored May 8, 2024
2 parents f579320 + ed14137 commit 23f2d50
Show file tree
Hide file tree
Showing 30 changed files with 1,478 additions and 662 deletions.
32 changes: 26 additions & 6 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,33 @@
name: CI

on: [pull_request]
on:
pull_request:
branches:
- master
push:
branches:
- master

jobs:
build:
run_tests:
name: Tests
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: icepuma/rust-action@master
- name: Checkout
uses: actions/checkout@v4

- name: Install dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
args: sh test.sh
packages: cargo dkms
version: 1.0

- name: Build module
working-directory: abuse-kmod
run: sudo make install

- name: Load module
run: sudo modprobe abuse

- name: Install abusectl
run: sudo cargo install -p abusectl
12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,14 @@ Cargo.lock
# These are backup files generated by rustfmt
**/*.rs.bk

perf*
tmp*

abuse-ramdisk.bin
nbd-ramdisk.bin

dd-read.sh
dd-perf-read.sh
dd-perf-write.sh

log
*.log
5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[workspace]
members = [
"userland-io",
"ramdisk"
"abuse",
"abusectl",
"abuse-ramdisk",
]
2 changes: 0 additions & 2 deletions Makefile

This file was deleted.

18 changes: 1 addition & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# userland-io

[![Crates.io](https://img.shields.io/crates/v/userland-io.svg)](https://crates.io/crates/userland-io)
[![documentation](https://docs.rs/userland-io/badge.svg)](https://docs.rs/userland-io)
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/akiradeveloper/userland-io/blob/master/LICENSE)

## Motivation
Expand All @@ -13,18 +11,4 @@ code output is usually hard to maintain. How do I know this? Because I've implem

When I met Rust language, soon I fell in love with the beautiful language and came to think of how it would be nice to write virtual block device in this language. With Rust, concurrent programming is not a difficult task while it is just like hell with C. Moreover, we can make use of sophisticated ecosystem and libraries from Rust community.

[fuse-rs](https://github.com/zargony/fuse-rs) is such a framework for filesystem layer but there nothing exists for block layer. That's why I started this project.

## Architecture

The client IO is coming from [NBD](https://github.com/NetworkBlockDevice/nbd). The TCP connection is split into read half and write half so reading and writing are executed simultaneously.
The NBD requests are interpreted and changed into generic request.

Right half of the figure is generic storage layer. The generic request in passed from the transport in queue. The executor sends it to storage engine asynchonously so all the requests are processed concurrently.

![Architecture](architecture.png)

## Futurework

- I think it would be so nice to have a working transport in Windows and Mac.
- A new target called dm-user is [proposed](https://www.redhat.com/archives/dm-devel/2020-December/msg00101.html) to upstream. dm-user is a DM target to proxy kernel bio to userland just like FUSE. This would bring better performance than with NBD because there is no TCP communication involved. If dm-user is merged, I will implement new transport in which IOs are coming from dm-user.
[fuse-rs](https://github.com/zargony/fuse-rs) is such a framework for filesystem layer but there nothing exists for block layer. That's why I started this project.
16 changes: 16 additions & 0 deletions abuse-kmod/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
MODULE_VERSION ?= 1.0.0
DKMS_DIR := /usr/src/abuse-$(MODULE_VERSION)
DKMS_KEY := -m abuse -v $(MODULE_VERSION)

install:
cp -r src $(DKMS_DIR)
dkms add $(DKMS_KEY)
dkms build $(DKMS_KEY)
dkms install $(DKMS_KEY)

uninstall:
dkms remove --all $(DKMS_KEY)
rm -rf $(DKMS_DIR)

.PHONY: reinstall
reinstall: uninstall install
11 changes: 11 additions & 0 deletions abuse-kmod/src/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.abuse*
abuse.ko
abuse.mod*
build.log
check-compile.sh
Module.symvers
modules.order
.tmp_versions
.Module.symvers.cmd
.modules.order.cmd
abuse.o
10 changes: 10 additions & 0 deletions abuse-kmod/src/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
KERNEL_SOURCE_VERSION ?= $(shell uname -r)
KERNEL_TREE ?= /lib/modules/$(KERNEL_SOURCE_VERSION)/build

obj-m := abuse.o

all:
$(MAKE) -C $(KERNEL_TREE) M=$(PWD) modules

clean:
$(MAKE) -C $(KERNEL_TREE) M=$(PWD) clean
Loading

0 comments on commit 23f2d50

Please # to comment.