Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ While this is a fork, we try to keep the changes to driver minimal to make syncs

| Kernel range | NonRAID module branch | Upstream base | Tested distros | Notes |
| ------------- | --------------------- | ------------- | -------------- | ------ |
| 6.1 - 6.4 | [nonraid-6.1](https://github.com/qvr/nonraid/tree/nonraid-6.1) | unRAID 6.12.15 (6.1.126-Unraid) | Debian 12 | Contains fixes backported from 6.6 branch |
| 6.5 - 6.8 | [nonraid-6.6](https://github.com/qvr/nonraid/tree/nonraid-6.6) | unRAID 7.0.1 (6.6.78-Unraid) | Ubuntu 24.04 LTS GA kernel | No functional difference to 6.12 branch |
| 6.11 - 6.18 | [nonraid-6.12](https://github.com/qvr/nonraid/tree/nonraid-6.12) | unRAID 7.1.2 (6.12.24-Unraid) | Ubuntu 24.04 LTS HWE kernel, Debian 13, Arch, Proxmox VE 9 | unRAID 7.2.0 has no changes to the kernel driver |
| 6.1 - 6.4 | [nonraid-6.1](https://github.com/qvr/nonraid/tree/nonraid-6.1) | unRAID 6.12.15 (6.1.126-Unraid) | Debian 12 | Contains fixes backported from 6.6 and 6.18 branch |
| 6.5 - 6.8 | [nonraid-6.6](https://github.com/qvr/nonraid/tree/nonraid-6.6) | unRAID 7.0.1 (6.6.78-Unraid) | Ubuntu 24.04 LTS GA kernel | Contains fixes backported from 6.18 branch |
| 6.11 - 7.0 | [nonraid-6.18](https://github.com/qvr/nonraid/tree/nonraid-6.18) | unRAID 7.3.0 (6.18.29-Unraid) | Ubuntu 24.04 LTS HWE kernel, Debian 13, Arch, Proxmox VE 9 | |

The supported kernel version ranges might be inaccurate, the driver has been tested to work on **Ubuntu 24.04 LTS** GA kernel (6.8.0) and HWE kernels (6.11 and 6.14), on **Debian 12** (6.1), on **Debian 13** (6.12), on **Arch Linux** lts kernel (6.12) and stable kernels (6.16, 6.17) and on **Proxmox VE 9** (6.14). Note that kernel versions 6.9 and 6.10 are not supported. You can report other distributions and kernel versions that work in the [discussions](https://github.com/qvr/nonraid/discussions).

Expand Down Expand Up @@ -276,7 +276,7 @@ BTRFS also works (`sudo mkfs.btrfs /dev/nmd3p1`).
For ZFS, name the pools as `diskN` where N is the slot number so that `nmdctl mount` works properly:

```bash
sudo zpool create disk3 /dev/nmd3p1
sudo zpool create -o ashift=12 disk3 /dev/nmd3p1
```

You can use any combination of different filesystems based on your needs.
Expand Down
2 changes: 1 addition & 1 deletion dkms.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ BUILT_MODULE_LOCATION[1]=raid6
DEST_MODULE_LOCATION[1]="/updates"
AUTOINSTALL="yes"
PACKAGE_NAME=nonraid-dkms
PACKAGE_VERSION=1.3.2
PACKAGE_VERSION=1.3.991
3 changes: 3 additions & 0 deletions md_nonraid/6.1/md_unraid.c
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,8 @@ static void md_submit_bio(struct bio *bi)
}

bi = bio_split_to_limits(bi);
if (!bi)
return;
bi->bi_opf &= ~REQ_NOMERGE;

unraid_make_request(mddev, unit, bi);
Expand Down Expand Up @@ -2249,4 +2251,5 @@ module_exit(md_exit);

MODULE_ALIAS("nonraid");
MODULE_ALIAS_BLOCKDEV_MAJOR(MAJOR_NR);
MODULE_DESCRIPTION("NonRAID array stacking driver");
MODULE_LICENSE("GPL");
19 changes: 16 additions & 3 deletions md_nonraid/6.1/unraid.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@

#include "md_unraid.h"

/*
* The global zero page.
*/
#define raid6_empty_zero_page page_address(ZERO_PAGE(0))

/*
* The following can be used to debug the driver
*/
Expand Down Expand Up @@ -1723,6 +1728,12 @@ void unraid_make_request(mddev_t *mddev, int unit, struct bio *bi)
/* check for requests before we're running */
BUG_ON(!conf);

/* check for REQ_OP_DISCARD - shouldn't happen */
if (unlikely(bio_op(bi) == REQ_OP_DISCARD)) {
/* just ignore it */
return;
}

/* check for REQ_FLUSH */
if (bi->bi_opf & REQ_PREFLUSH) {
dprintk("got a flush: disk: %d\n", unit);
Expand Down Expand Up @@ -1795,8 +1806,6 @@ static void unraidd(mddev_t *mddev, unsigned long unit)

dprintk("nonraidd%d: activated\n", (int)unit);

blk_start_plug(&plug);

spin_lock_irq(&conf->device_lock);
while (!list_empty(&conf->handle_list[unit])) {
struct list_head *first;
Expand All @@ -1811,6 +1820,9 @@ static void unraidd(mddev_t *mddev, unsigned long unit)

spin_unlock_irq(&conf->device_lock);

if (count == 0)
blk_start_plug(&plug);

handle_stripe(sh);
release_stripe(sh);
count++;
Expand All @@ -1819,7 +1831,8 @@ static void unraidd(mddev_t *mddev, unsigned long unit)
}
spin_unlock_irq(&conf->device_lock);

blk_finish_plug(&plug);
if (count)
blk_finish_plug(&plug);

dprintk("nonraidd%d: handled %d stripes\n", (int)unit, count);
}
Expand Down
1 change: 0 additions & 1 deletion md_nonraid/6.12/README.md

This file was deleted.

1 change: 1 addition & 0 deletions md_nonraid/6.18/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
These files are copied from [nonraid-6.18 branch](https://github.com/qvr/nonraid/tree/nonraid-6.18) that is used to track upstream changes and rebase nonraid patches on top of them. Check that branch for commit history.
54 changes: 41 additions & 13 deletions md_nonraid/6.12/md_unraid.c → md_nonraid/6.18/md_unraid.c
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,8 @@ static void md_submit_bio(struct bio *bi)
}

bi = bio_split_to_limits(bi);
if (!bi)
return;
bi->bi_opf &= ~REQ_NOMERGE;

unraid_make_request(mddev, unit, bi);
Expand Down Expand Up @@ -985,6 +987,40 @@ static struct block_device_operations md_fops =
// .revalidate_disk= md_revalidate,
};

static struct queue_limits *md_set_queue_limits(struct queue_limits *lim, mdk_rdev_t *rdev)
{
/* set default stacking limits */
blk_set_stacking_limits(lim);
lim->features = BLK_FEAT_WRITE_CACHE | BLK_FEAT_FUA | BLK_FEAT_IO_STAT | BLK_FEAT_NOWAIT;

/* merge lower device limits */
if (!strstr(rdev->status, "DISK_NP")) {
queue_limits_stack_bdev(lim, rdev->bdev, rdev->offset, rdev->name);
}

/* disk being emulated, set some missing defaults */
if (strstr(rdev->status, "DISK_NP")) {
lim->max_zone_append_sectors = 0;
}

/* we must override selected merged limits */
lim->logical_block_size = 512;
lim->physical_block_size = 4096;
lim->dma_alignment = 511;
lim->io_min = 512;
lim->io_opt = 128 * 1024;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0)
lim->max_hw_wzeroes_unmap_sectors = 0;
#endif
lim->max_secure_erase_sectors = 0; /* disable secure_erase */
lim->max_write_zeroes_sectors = 0; /* disable write_zeroes */
lim->max_hw_sectors = 256; /* 256 sectors => 128K */
lim->max_hw_discard_sectors = 0; /* disable discard */
lim->max_discard_sectors = 0;
lim->discard_granularity = 0;
return lim;
}

static int do_run(mddev_t *mddev)
{
mdp_super_t *sb = &mddev->sb;
Expand Down Expand Up @@ -1017,10 +1053,12 @@ static int do_run(mddev_t *mddev)
/* create the md devices */
for (i = 1; i <= 28; i++) {
mdp_disk_t *disk = &sb->disks[i];
struct queue_limits lim;

if (disk_active(disk) || disk_enabled(disk)) {
int unit = disk->number;
struct gendisk *gd = blk_alloc_disk(NULL,NUMA_NO_NODE);
mdk_rdev_t *rdev = &mddev->rdev[i];
int unit = disk->number;
int ret;

mddev->gendisk[unit] = gd;
Expand All @@ -1032,21 +1070,10 @@ static int do_run(mddev_t *mddev)
gd->fops = &md_fops;
gd->private_data = mddev;
gd->queue->queuedata = mddev;
queue_limits_set(gd->queue, md_set_queue_limits(&lim, rdev));

/* capacity in 512-byte sectors */
set_capacity(gd, disk->size*2);

blk_set_stacking_limits(&gd->queue->limits);
gd->queue->limits.features = BLK_FEAT_WRITE_CACHE | BLK_FEAT_FUA |
BLK_FEAT_IO_STAT | BLK_FEAT_NOWAIT |
BLK_FEAT_ROTATIONAL;

blk_queue_disable_discard(gd->queue);
blk_queue_disable_secure_erase(gd->queue);
blk_queue_disable_write_zeroes(gd->queue);

if (md_restrict & 1)
gd->queue->limits.max_hw_sectors = 256; /* 256 sectors => 128K */

ret = add_disk(gd);
printk("nmd%dp1: running, size: %llu blocks\n", unit, disk->size);
Expand Down Expand Up @@ -2249,4 +2276,5 @@ module_exit(md_exit);

MODULE_ALIAS("nonraid");
MODULE_ALIAS_BLOCKDEV_MAJOR(MAJOR_NR);
MODULE_DESCRIPTION("NonRAID array stacking driver");
MODULE_LICENSE("GPL");
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ extern void (*raid6_xor_syndrome)(int, int, int, size_t, void **);
*/
#define MD_MAJOR_VERSION 2
#define MD_MINOR_VERSION 9
#define MD_PATCHLEVEL_VERSION 35
#define MD_PATCHLEVEL_VERSION 40

/****************************************************************************/
/* 'md_p.h' holds the 'physical' layout of RAID devices */
Expand Down
19 changes: 16 additions & 3 deletions md_nonraid/6.12/unraid.c → md_nonraid/6.18/unraid.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@

#include "md_unraid.h"

/*
* The global zero page.
*/
#define raid6_empty_zero_page page_address(ZERO_PAGE(0))

/*
* The following can be used to debug the driver
*/
Expand Down Expand Up @@ -1723,6 +1728,12 @@ void unraid_make_request(mddev_t *mddev, int unit, struct bio *bi)
/* check for requests before we're running */
BUG_ON(!conf);

/* check for REQ_OP_DISCARD - shouldn't happen */
if (unlikely(bio_op(bi) == REQ_OP_DISCARD)) {
/* just ignore it */
return;
}

/* check for REQ_FLUSH */
if (bi->bi_opf & REQ_PREFLUSH) {
dprintk("got a flush: disk: %d\n", unit);
Expand Down Expand Up @@ -1795,8 +1806,6 @@ static void unraidd(mddev_t *mddev, unsigned long unit)

dprintk("nonraidd%d: activated\n", (int)unit);

blk_start_plug(&plug);

spin_lock_irq(&conf->device_lock);
while (!list_empty(&conf->handle_list[unit])) {
struct list_head *first;
Expand All @@ -1811,6 +1820,9 @@ static void unraidd(mddev_t *mddev, unsigned long unit)

spin_unlock_irq(&conf->device_lock);

if (count == 0)
blk_start_plug(&plug);

handle_stripe(sh);
release_stripe(sh);
count++;
Expand All @@ -1819,7 +1831,8 @@ static void unraidd(mddev_t *mddev, unsigned long unit)
}
spin_unlock_irq(&conf->device_lock);

blk_finish_plug(&plug);
if (count)
blk_finish_plug(&plug);

dprintk("nonraidd%d: handled %d stripes\n", (int)unit, count);
}
Expand Down
3 changes: 3 additions & 0 deletions md_nonraid/6.6/md_unraid.c
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,8 @@ static void md_submit_bio(struct bio *bi)
}

bi = bio_split_to_limits(bi);
if (!bi)
return;
bi->bi_opf &= ~REQ_NOMERGE;

unraid_make_request(mddev, unit, bi);
Expand Down Expand Up @@ -2247,4 +2249,5 @@ module_exit(md_exit);

MODULE_ALIAS("nonraid");
MODULE_ALIAS_BLOCKDEV_MAJOR(MAJOR_NR);
MODULE_DESCRIPTION("NonRAID array stacking driver");
MODULE_LICENSE("GPL");
19 changes: 16 additions & 3 deletions md_nonraid/6.6/unraid.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@

#include "md_unraid.h"

/*
* The global zero page.
*/
#define raid6_empty_zero_page page_address(ZERO_PAGE(0))

/*
* The following can be used to debug the driver
*/
Expand Down Expand Up @@ -1723,6 +1728,12 @@ void unraid_make_request(mddev_t *mddev, int unit, struct bio *bi)
/* check for requests before we're running */
BUG_ON(!conf);

/* check for REQ_OP_DISCARD - shouldn't happen */
if (unlikely(bio_op(bi) == REQ_OP_DISCARD)) {
/* just ignore it */
return;
}

/* check for REQ_FLUSH */
if (bi->bi_opf & REQ_PREFLUSH) {
dprintk("got a flush: disk: %d\n", unit);
Expand Down Expand Up @@ -1795,8 +1806,6 @@ static void unraidd(mddev_t *mddev, unsigned long unit)

dprintk("nonraidd%d: activated\n", (int)unit);

blk_start_plug(&plug);

spin_lock_irq(&conf->device_lock);
while (!list_empty(&conf->handle_list[unit])) {
struct list_head *first;
Expand All @@ -1811,6 +1820,9 @@ static void unraidd(mddev_t *mddev, unsigned long unit)

spin_unlock_irq(&conf->device_lock);

if (count == 0)
blk_start_plug(&plug);

handle_stripe(sh);
release_stripe(sh);
count++;
Expand All @@ -1819,7 +1831,8 @@ static void unraidd(mddev_t *mddev, unsigned long unit)
}
spin_unlock_irq(&conf->device_lock);

blk_finish_plug(&plug);
if (count)
blk_finish_plug(&plug);

dprintk("nonraidd%d: handled %d stripes\n", (int)unit, count);
}
Expand Down
2 changes: 1 addition & 1 deletion md_nonraid/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ K_GT_6_8 := $(shell [ $(K_MAJOR) -gt 6 -o \( $(K_MAJOR) -eq 6 -a $(K_MINOR) -gt
K_GE_6_5 := $(shell [ $(K_MAJOR) -gt 6 -o \( $(K_MAJOR) -eq 6 -a $(K_MINOR) -ge 5 \) ] && echo true)

ifeq ($(K_GT_6_8),true)
md-nonraid-m += 6.12/md_unraid.o 6.12/unraid.o
md-nonraid-m += 6.18/md_unraid.o 6.18/unraid.o
else ifeq ($(K_GE_6_5),true)
md-nonraid-m += 6.6/md_unraid.o 6.6/unraid.o
else
Expand Down
Loading