Skip to content
Closed
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
28 changes: 28 additions & 0 deletions .github/workflows/kernel_build.yml
Original file line number Diff line number Diff line change
@@ -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

8 changes: 5 additions & 3 deletions block/blk-settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down
3 changes: 2 additions & 1 deletion drivers/md/dm-stripe.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions drivers/md/dm-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions drivers/md/raid0.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions drivers/md/raid10.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions include/linux/device-mapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down