diff --git a/.github/workflows/kernel_build.yml b/.github/workflows/kernel_build.yml new file mode 100644 index 0000000000000..cd0f9d145429c --- /dev/null +++ b/.github/workflows/kernel_build.yml @@ -0,0 +1,28 @@ +name: blktests-ci + +on: + pull_request: + +jobs: + build-kernel: + runs-on: ubuntu-latest + steps: + - name: Configure git + run: | + git config --global --add safe.directory '*' + - name: Checkout git + run: | + sudo apt-get install -y libelf-dev + mkdir -p linux + cd linux + git init + git remote add origin https://github.com/${{ github.repository }} + git fetch origin --depth=5 ${{ github.event.pull_request.head.sha }} + git reset --hard ${{ github.event.pull_request.head.sha }} + git log -1 + - name: Build kernel + run: | + cd linux + make defconfig + make -j 8 + diff --git a/block/blk-settings.c b/block/blk-settings.c index a000daafbfb48..5b0f1a854e815 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c @@ -594,11 +594,13 @@ static bool blk_stack_atomic_writes_boundary_head(struct queue_limits *t, static bool blk_stack_atomic_writes_head(struct queue_limits *t, struct queue_limits *b) { + unsigned int chunk_size = t->chunk_sectors << SECTOR_SHIFT; + if (b->atomic_write_hw_boundary && !blk_stack_atomic_writes_boundary_head(t, b)) return false; - if (t->io_min <= SECTOR_SIZE) { + if (!t->chunk_sectors) { /* No chunk sectors, so use bottom device values directly */ t->atomic_write_hw_unit_max = b->atomic_write_hw_unit_max; t->atomic_write_hw_unit_min = b->atomic_write_hw_unit_min; @@ -617,12 +619,12 @@ static bool blk_stack_atomic_writes_head(struct queue_limits *t, * aligned with both limits, i.e. 8K in this example. */ t->atomic_write_hw_unit_max = b->atomic_write_hw_unit_max; - while (t->io_min % t->atomic_write_hw_unit_max) + while (chunk_size % t->atomic_write_hw_unit_max) t->atomic_write_hw_unit_max /= 2; t->atomic_write_hw_unit_min = min(b->atomic_write_hw_unit_min, t->atomic_write_hw_unit_max); - t->atomic_write_hw_max = min(b->atomic_write_hw_max, t->io_min); + t->atomic_write_hw_max = min(b->atomic_write_hw_max, chunk_size); return true; } diff --git a/drivers/md/dm-stripe.c b/drivers/md/dm-stripe.c index a7dc04bd55e5c..c30df6715149f 100644 --- a/drivers/md/dm-stripe.c +++ b/drivers/md/dm-stripe.c @@ -466,7 +466,8 @@ static struct target_type stripe_target = { .name = "striped", .version = {1, 7, 0}, .features = DM_TARGET_PASSES_INTEGRITY | DM_TARGET_NOWAIT | - DM_TARGET_ATOMIC_WRITES | DM_TARGET_PASSES_CRYPTO, + DM_TARGET_ATOMIC_WRITES | DM_TARGET_PASSES_CRYPTO | + DM_TARGET_STRIPED, .module = THIS_MODULE, .ctr = stripe_ctr, .dtr = stripe_dtr, diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 24a857ff6d0b1..4f1f7173740c2 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -430,6 +430,10 @@ static int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev, return 0; } + /* For striped types, limit the chunk_sectors to the chunk size */ + if (dm_target_supports_striped(ti->type)) + limits->chunk_sectors = len >> SECTOR_SHIFT; + mutex_lock(&q->limits_lock); /* * BLK_FEAT_ATOMIC_WRITES is not inherited from the bottom device in diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index d8f639f4ae123..cbe2a9054cb91 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c @@ -384,6 +384,7 @@ static int raid0_set_limits(struct mddev *mddev) lim.max_write_zeroes_sectors = mddev->chunk_sectors; lim.io_min = mddev->chunk_sectors << 9; lim.io_opt = lim.io_min * mddev->raid_disks; + lim.chunk_sectors = mddev->chunk_sectors; lim.features |= BLK_FEAT_ATOMIC_WRITES; err = mddev_stack_rdev_limits(mddev, &lim, MDDEV_STACK_INTEGRITY); if (err) diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index b74780af4c220..97065bb26f430 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -4004,6 +4004,7 @@ static int raid10_set_queue_limits(struct mddev *mddev) md_init_stacking_limits(&lim); lim.max_write_zeroes_sectors = 0; lim.io_min = mddev->chunk_sectors << 9; + lim.chunk_sectors = mddev->chunk_sectors; lim.io_opt = lim.io_min * raid10_nr_stripes(conf); lim.features |= BLK_FEAT_ATOMIC_WRITES; err = mddev_stack_rdev_limits(mddev, &lim, MDDEV_STACK_INTEGRITY); diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h index cb95951547abe..a863523b69eee 100644 --- a/include/linux/device-mapper.h +++ b/include/linux/device-mapper.h @@ -309,6 +309,9 @@ struct target_type { #define DM_TARGET_ATOMIC_WRITES 0x00000400 #define dm_target_supports_atomic_writes(type) ((type)->features & DM_TARGET_ATOMIC_WRITES) +#define DM_TARGET_STRIPED 0x00000800 +#define dm_target_supports_striped(type) ((type)->features & DM_TARGET_STRIPED) + struct dm_target { struct dm_table *table; struct target_type *type;