Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…/git/song/md into for-5.18/drivers

Pull MD fixes from Song:

"Most of these changes are minor fixes and clean-ups."

* 'md-next' of https://git.kernel.org/pub/scm/linux/kernel/git/song/md:
  md: use msleep() in md_notify_reboot()
  lib/raid6: Include <asm/ppc-opcode.h> for VPERMXOR
  lib/raid6/test/Makefile: Use $(pound) instead of \# for Make 4.3
  lib/raid6/test: fix multiple definition linking error
  md: raid1/raid10: drop pending_cnt
Jens Axboe committed Mar 8, 2022
2 parents a763706 + 7d959f6 commit a2daeab
Showing 9 changed files with 13 additions and 31 deletions.
2 changes: 1 addition & 1 deletion drivers/md/md.c
Original file line number Diff line number Diff line change
@@ -9582,7 +9582,7 @@ static int md_notify_reboot(struct notifier_block *this,
* driver, we do want to have a safe RAID driver ...
*/
if (need_delay)
mdelay(1000*1);
msleep(1000);

return NOTIFY_DONE;
}
5 changes: 5 additions & 0 deletions drivers/md/raid1-10.c
Original file line number Diff line number Diff line change
@@ -28,6 +28,11 @@ struct resync_pages {
struct page *pages[RESYNC_PAGES];
};

struct raid1_plug_cb {
struct blk_plug_cb cb;
struct bio_list pending;
};

static void rbio_pool_free(void *rbio, void *data)
{
kfree(rbio);
11 changes: 0 additions & 11 deletions drivers/md/raid1.c
Original file line number Diff line number Diff line change
@@ -824,7 +824,6 @@ static void flush_pending_writes(struct r1conf *conf)
struct bio *bio;

bio = bio_list_get(&conf->pending_bio_list);
conf->pending_count = 0;
spin_unlock_irq(&conf->device_lock);

/*
@@ -1167,12 +1166,6 @@ static void alloc_behind_master_bio(struct r1bio *r1_bio,
bio_put(behind_bio);
}

struct raid1_plug_cb {
struct blk_plug_cb cb;
struct bio_list pending;
int pending_cnt;
};

static void raid1_unplug(struct blk_plug_cb *cb, bool from_schedule)
{
struct raid1_plug_cb *plug = container_of(cb, struct raid1_plug_cb,
@@ -1184,7 +1177,6 @@ static void raid1_unplug(struct blk_plug_cb *cb, bool from_schedule)
if (from_schedule || current->bio_list) {
spin_lock_irq(&conf->device_lock);
bio_list_merge(&conf->pending_bio_list, &plug->pending);
conf->pending_count += plug->pending_cnt;
spin_unlock_irq(&conf->device_lock);
wake_up(&conf->wait_barrier);
md_wakeup_thread(mddev->thread);
@@ -1588,11 +1580,9 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio,
plug = NULL;
if (plug) {
bio_list_add(&plug->pending, mbio);
plug->pending_cnt++;
} else {
spin_lock_irqsave(&conf->device_lock, flags);
bio_list_add(&conf->pending_bio_list, mbio);
conf->pending_count++;
spin_unlock_irqrestore(&conf->device_lock, flags);
md_wakeup_thread(mddev->thread);
}
@@ -3058,7 +3048,6 @@ static struct r1conf *setup_conf(struct mddev *mddev)
init_waitqueue_head(&conf->wait_barrier);

bio_list_init(&conf->pending_bio_list);
conf->pending_count = 0;
conf->recovery_disabled = mddev->recovery_disabled - 1;

err = -EIO;
1 change: 0 additions & 1 deletion drivers/md/raid1.h
Original file line number Diff line number Diff line change
@@ -87,7 +87,6 @@ struct r1conf {

/* queue pending writes to be submitted on unplug */
struct bio_list pending_bio_list;
int pending_count;

/* for use when syncing mirrors:
* We don't allow both normal IO and resync/recovery IO at
17 changes: 3 additions & 14 deletions drivers/md/raid10.c
Original file line number Diff line number Diff line change
@@ -861,7 +861,6 @@ static void flush_pending_writes(struct r10conf *conf)
struct bio *bio;

bio = bio_list_get(&conf->pending_bio_list);
conf->pending_count = 0;
spin_unlock_irq(&conf->device_lock);

/*
@@ -1054,24 +1053,16 @@ static sector_t choose_data_offset(struct r10bio *r10_bio,
return rdev->new_data_offset;
}

struct raid10_plug_cb {
struct blk_plug_cb cb;
struct bio_list pending;
int pending_cnt;
};

static void raid10_unplug(struct blk_plug_cb *cb, bool from_schedule)
{
struct raid10_plug_cb *plug = container_of(cb, struct raid10_plug_cb,
cb);
struct raid1_plug_cb *plug = container_of(cb, struct raid1_plug_cb, cb);
struct mddev *mddev = plug->cb.data;
struct r10conf *conf = mddev->private;
struct bio *bio;

if (from_schedule || current->bio_list) {
spin_lock_irq(&conf->device_lock);
bio_list_merge(&conf->pending_bio_list, &plug->pending);
conf->pending_count += plug->pending_cnt;
spin_unlock_irq(&conf->device_lock);
wake_up(&conf->wait_barrier);
md_wakeup_thread(mddev->thread);
@@ -1238,7 +1229,7 @@ static void raid10_write_one_disk(struct mddev *mddev, struct r10bio *r10_bio,
const unsigned long do_fua = (bio->bi_opf & REQ_FUA);
unsigned long flags;
struct blk_plug_cb *cb;
struct raid10_plug_cb *plug = NULL;
struct raid1_plug_cb *plug = NULL;
struct r10conf *conf = mddev->private;
struct md_rdev *rdev;
int devnum = r10_bio->devs[n_copy].devnum;
@@ -1280,16 +1271,14 @@ static void raid10_write_one_disk(struct mddev *mddev, struct r10bio *r10_bio,

cb = blk_check_plugged(raid10_unplug, mddev, sizeof(*plug));
if (cb)
plug = container_of(cb, struct raid10_plug_cb, cb);
plug = container_of(cb, struct raid1_plug_cb, cb);
else
plug = NULL;
if (plug) {
bio_list_add(&plug->pending, mbio);
plug->pending_cnt++;
} else {
spin_lock_irqsave(&conf->device_lock, flags);
bio_list_add(&conf->pending_bio_list, mbio);
conf->pending_count++;
spin_unlock_irqrestore(&conf->device_lock, flags);
md_wakeup_thread(mddev->thread);
}
1 change: 0 additions & 1 deletion drivers/md/raid10.h
Original file line number Diff line number Diff line change
@@ -75,7 +75,6 @@ struct r10conf {

/* queue pending writes and submit them on unplug */
struct bio_list pending_bio_list;
int pending_count;

spinlock_t resync_lock;
atomic_t nr_pending;
4 changes: 3 additions & 1 deletion lib/raid6/test/Makefile
Original file line number Diff line number Diff line change
@@ -4,6 +4,8 @@
# from userspace.
#

pound := \#

CC = gcc
OPTFLAGS = -O2 # Adjust as desired
CFLAGS = -I.. -I ../../../include -g $(OPTFLAGS)
@@ -42,7 +44,7 @@ else ifeq ($(HAS_NEON),yes)
OBJS += neon.o neon1.o neon2.o neon4.o neon8.o recov_neon.o recov_neon_inner.o
CFLAGS += -DCONFIG_KERNEL_MODE_NEON=1
else
HAS_ALTIVEC := $(shell printf '\#include <altivec.h>\nvector int a;\n' |\
HAS_ALTIVEC := $(shell printf '$(pound)include <altivec.h>\nvector int a;\n' |\
gcc -c -x c - >/dev/null && rm ./-.o && echo yes)
ifeq ($(HAS_ALTIVEC),yes)
CFLAGS += -I../../../arch/powerpc/include
1 change: 0 additions & 1 deletion lib/raid6/test/test.c
Original file line number Diff line number Diff line change
@@ -19,7 +19,6 @@
#define NDISKS 16 /* Including P and Q */

const char raid6_empty_zero_page[PAGE_SIZE] __attribute__((aligned(PAGE_SIZE)));
struct raid6_calls raid6_call;

char *dataptrs[NDISKS];
char data[NDISKS][PAGE_SIZE] __attribute__((aligned(PAGE_SIZE)));
2 changes: 1 addition & 1 deletion lib/raid6/vpermxor.uc
Original file line number Diff line number Diff line change
@@ -24,9 +24,9 @@
#ifdef CONFIG_ALTIVEC

#include <altivec.h>
#include <asm/ppc-opcode.h>
#ifdef __KERNEL__
#include <asm/cputable.h>
#include <asm/ppc-opcode.h>
#include <asm/switch_to.h>
#endif

0 comments on commit a2daeab

Please sign in to comment.