Skip to content

Commit

Permalink
Merge tag 'for-5.18/write-streams-2022-03-18' of git://git.kernel.dk/…
Browse files Browse the repository at this point in the history
…linux-block

Pull NVMe write streams removal from Jens Axboe:
 "This removes the write streams support in NVMe. No vendor ever really
  shipped working support for this, and they are not interested in
  supporting it.

  With the NVMe support gone, we have nothing in the tree that supports
  this. Remove passing around of the hints.

  The only discussion point in this patchset imho is the fact that the
  file specific write hint setting/getting fcntl helpers will now return
  -1/EINVAL like they did before we supported write hints. No known
  applications use these functions, I only know of one prototype that I
  help do for RocksDB, and that's not used. That said, with a change
  like this, it's always a bit controversial. Alternatively, we could
  just make them return 0 and pretend it worked. It's placement based
  hints after all"

* tag 'for-5.18/write-streams-2022-03-18' of git://git.kernel.dk/linux-block:
  fs: remove fs.f_write_hint
  fs: remove kiocb.ki_hint
  block: remove the per-bio/request write hint
  nvme: remove support or stream based temperature hint
  • Loading branch information
torvalds committed Mar 26, 2022
2 parents 9bf3fc5 + 7b12e49 commit 561593a
Show file tree
Hide file tree
Showing 32 changed files with 10 additions and 303 deletions.
2 changes: 0 additions & 2 deletions block/bio.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ void bio_init(struct bio *bio, struct block_device *bdev, struct bio_vec *table,
bio->bi_opf = opf;
bio->bi_flags = 0;
bio->bi_ioprio = 0;
bio->bi_write_hint = 0;
bio->bi_status = 0;
bio->bi_iter.bi_sector = 0;
bio->bi_iter.bi_size = 0;
Expand Down Expand Up @@ -737,7 +736,6 @@ static int __bio_clone(struct bio *bio, struct bio *bio_src, gfp_t gfp)
bio_flagged(bio_src, BIO_REMAPPED))
bio_set_flag(bio, BIO_REMAPPED);
bio->bi_ioprio = bio_src->bi_ioprio;
bio->bi_write_hint = bio_src->bi_write_hint;
bio->bi_iter = bio_src->bi_iter;

bio_clone_blkg_association(bio, bio_src);
Expand Down
1 change: 0 additions & 1 deletion block/blk-crypto-fallback.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ static struct bio *blk_crypto_fallback_clone_bio(struct bio *bio_src)
bio_set_flag(bio, BIO_REMAPPED);
bio->bi_opf = bio_src->bi_opf;
bio->bi_ioprio = bio_src->bi_ioprio;
bio->bi_write_hint = bio_src->bi_write_hint;
bio->bi_iter.bi_sector = bio_src->bi_iter.bi_sector;
bio->bi_iter.bi_size = bio_src->bi_iter.bi_size;

Expand Down
14 changes: 0 additions & 14 deletions block/blk-merge.c
Original file line number Diff line number Diff line change
Expand Up @@ -754,13 +754,6 @@ static struct request *attempt_merge(struct request_queue *q,
if (rq_data_dir(req) != rq_data_dir(next))
return NULL;

/*
* Don't allow merge of different write hints, or for a hint with
* non-hint IO.
*/
if (req->write_hint != next->write_hint)
return NULL;

if (req->ioprio != next->ioprio)
return NULL;

Expand Down Expand Up @@ -886,13 +879,6 @@ bool blk_rq_merge_ok(struct request *rq, struct bio *bio)
if (!bio_crypt_rq_ctx_compatible(rq, bio))
return false;

/*
* Don't allow merge of different write hints, or for a hint with
* non-hint IO.
*/
if (rq->write_hint != bio->bi_write_hint)
return false;

if (rq->ioprio != bio_prio(bio))
return false;

Expand Down
24 changes: 0 additions & 24 deletions block/blk-mq-debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,35 +183,11 @@ static ssize_t queue_state_write(void *data, const char __user *buf,
return count;
}

static int queue_write_hint_show(void *data, struct seq_file *m)
{
struct request_queue *q = data;
int i;

for (i = 0; i < BLK_MAX_WRITE_HINTS; i++)
seq_printf(m, "hint%d: %llu\n", i, q->write_hints[i]);

return 0;
}

static ssize_t queue_write_hint_store(void *data, const char __user *buf,
size_t count, loff_t *ppos)
{
struct request_queue *q = data;
int i;

for (i = 0; i < BLK_MAX_WRITE_HINTS; i++)
q->write_hints[i] = 0;

return count;
}

static const struct blk_mq_debugfs_attr blk_mq_debugfs_queue_attrs[] = {
{ "poll_stat", 0400, queue_poll_stat_show },
{ "requeue_list", 0400, .seq_ops = &queue_requeue_list_seq_ops },
{ "pm_only", 0600, queue_pm_only_show, NULL },
{ "state", 0600, queue_state_show, queue_state_write },
{ "write_hints", 0600, queue_write_hint_show, queue_write_hint_store },
{ "zone_wlock", 0400, queue_zone_wlock_show, NULL },
{ },
};
Expand Down
1 change: 0 additions & 1 deletion block/blk-mq.c
Original file line number Diff line number Diff line change
Expand Up @@ -2412,7 +2412,6 @@ static void blk_mq_bio_to_request(struct request *rq, struct bio *bio,
rq->cmd_flags |= REQ_FAILFAST_MASK;

rq->__sector = bio->bi_iter.bi_sector;
rq->write_hint = bio->bi_write_hint;
blk_rq_bio_prep(rq, bio, nr_segs);

/* This can't fail, since GFP_NOIO includes __GFP_DIRECT_RECLAIM. */
Expand Down
1 change: 0 additions & 1 deletion block/bounce.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ static struct bio *bounce_clone_bio(struct bio *bio_src)
if (bio_flagged(bio_src, BIO_REMAPPED))
bio_set_flag(bio, BIO_REMAPPED);
bio->bi_ioprio = bio_src->bi_ioprio;
bio->bi_write_hint = bio_src->bi_write_hint;
bio->bi_iter.bi_sector = bio_src->bi_iter.bi_sector;
bio->bi_iter.bi_size = bio_src->bi_iter.bi_size;

Expand Down
3 changes: 0 additions & 3 deletions block/fops.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ static ssize_t __blkdev_direct_IO_simple(struct kiocb *iocb,
bio_init(&bio, bdev, vecs, nr_pages, dio_bio_write_op(iocb));
}
bio.bi_iter.bi_sector = pos >> SECTOR_SHIFT;
bio.bi_write_hint = iocb->ki_hint;
bio.bi_private = current;
bio.bi_end_io = blkdev_bio_end_io_simple;
bio.bi_ioprio = iocb->ki_ioprio;
Expand Down Expand Up @@ -225,7 +224,6 @@ static ssize_t __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter,

for (;;) {
bio->bi_iter.bi_sector = pos >> SECTOR_SHIFT;
bio->bi_write_hint = iocb->ki_hint;
bio->bi_private = dio;
bio->bi_end_io = blkdev_bio_end_io;
bio->bi_ioprio = iocb->ki_ioprio;
Expand Down Expand Up @@ -327,7 +325,6 @@ static ssize_t __blkdev_direct_IO_async(struct kiocb *iocb,
dio->flags = 0;
dio->iocb = iocb;
bio->bi_iter.bi_sector = pos >> SECTOR_SHIFT;
bio->bi_write_hint = iocb->ki_hint;
bio->bi_end_io = blkdev_bio_end_io_async;
bio->bi_ioprio = iocb->ki_ioprio;

Expand Down
2 changes: 0 additions & 2 deletions drivers/md/raid1.c
Original file line number Diff line number Diff line change
Expand Up @@ -1136,8 +1136,6 @@ static void alloc_behind_master_bio(struct r1bio *r1_bio,
goto skip_copy;
}

behind_bio->bi_write_hint = bio->bi_write_hint;

while (i < vcnt && size) {
struct page *page;
int len = min_t(int, PAGE_SIZE, size);
Expand Down
28 changes: 3 additions & 25 deletions drivers/md/raid5-ppl.c
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,6 @@ static void ppl_submit_iounit(struct ppl_io_unit *io)
bio->bi_end_io = ppl_log_endio;
bio->bi_iter.bi_sector = log->next_io_sector;
bio_add_page(bio, io->header_page, PAGE_SIZE, 0);
bio->bi_write_hint = ppl_conf->write_hint;

pr_debug("%s: log->current_io_sector: %llu\n", __func__,
(unsigned long long)log->next_io_sector);
Expand Down Expand Up @@ -496,7 +495,6 @@ static void ppl_submit_iounit(struct ppl_io_unit *io)
bio = bio_alloc_bioset(prev->bi_bdev, BIO_MAX_VECS,
prev->bi_opf, GFP_NOIO,
&ppl_conf->bs);
bio->bi_write_hint = prev->bi_write_hint;
bio->bi_iter.bi_sector = bio_end_sector(prev);
bio_add_page(bio, sh->ppl_page, PAGE_SIZE, 0);

Expand Down Expand Up @@ -1396,7 +1394,6 @@ int ppl_init_log(struct r5conf *conf)
atomic64_set(&ppl_conf->seq, 0);
INIT_LIST_HEAD(&ppl_conf->no_mem_stripes);
spin_lock_init(&ppl_conf->no_mem_stripes_lock);
ppl_conf->write_hint = RWH_WRITE_LIFE_NOT_SET;

if (!mddev->external) {
ppl_conf->signature = ~crc32c_le(~0, mddev->uuid, sizeof(mddev->uuid));
Expand Down Expand Up @@ -1495,25 +1492,13 @@ int ppl_modify_log(struct r5conf *conf, struct md_rdev *rdev, bool add)
static ssize_t
ppl_write_hint_show(struct mddev *mddev, char *buf)
{
size_t ret = 0;
struct r5conf *conf;
struct ppl_conf *ppl_conf = NULL;

spin_lock(&mddev->lock);
conf = mddev->private;
if (conf && raid5_has_ppl(conf))
ppl_conf = conf->log_private;
ret = sprintf(buf, "%d\n", ppl_conf ? ppl_conf->write_hint : 0);
spin_unlock(&mddev->lock);

return ret;
return sprintf(buf, "%d\n", 0);
}

static ssize_t
ppl_write_hint_store(struct mddev *mddev, const char *page, size_t len)
{
struct r5conf *conf;
struct ppl_conf *ppl_conf;
int err = 0;
unsigned short new;

Expand All @@ -1527,17 +1512,10 @@ ppl_write_hint_store(struct mddev *mddev, const char *page, size_t len)
return err;

conf = mddev->private;
if (!conf) {
if (!conf)
err = -ENODEV;
} else if (raid5_has_ppl(conf)) {
ppl_conf = conf->log_private;
if (!ppl_conf)
err = -EINVAL;
else
ppl_conf->write_hint = new;
} else {
else if (!raid5_has_ppl(conf) || !conf->log_private)
err = -EINVAL;
}

mddev_unlock(mddev);

Expand Down
6 changes: 0 additions & 6 deletions drivers/md/raid5.c
Original file line number Diff line number Diff line change
Expand Up @@ -1211,9 +1211,6 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s)
bi->bi_io_vec[0].bv_len = RAID5_STRIPE_SIZE(conf);
bi->bi_io_vec[0].bv_offset = sh->dev[i].offset;
bi->bi_iter.bi_size = RAID5_STRIPE_SIZE(conf);
bi->bi_write_hint = sh->dev[i].write_hint;
if (!rrdev)
sh->dev[i].write_hint = RWH_WRITE_LIFE_NOT_SET;
/*
* If this is discard request, set bi_vcnt 0. We don't
* want to confuse SCSI because SCSI will replace payload
Expand Down Expand Up @@ -1264,8 +1261,6 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s)
rbi->bi_io_vec[0].bv_len = RAID5_STRIPE_SIZE(conf);
rbi->bi_io_vec[0].bv_offset = sh->dev[i].offset;
rbi->bi_iter.bi_size = RAID5_STRIPE_SIZE(conf);
rbi->bi_write_hint = sh->dev[i].write_hint;
sh->dev[i].write_hint = RWH_WRITE_LIFE_NOT_SET;
/*
* If this is discard request, set bi_vcnt 0. We don't
* want to confuse SCSI because SCSI will replace payload
Expand Down Expand Up @@ -3407,7 +3402,6 @@ static int add_stripe_bio(struct stripe_head *sh, struct bio *bi, int dd_idx,
(unsigned long long)sh->sector);

spin_lock_irq(&sh->stripe_lock);
sh->dev[dd_idx].write_hint = bi->bi_write_hint;
/* Don't allow new IO added to stripes in batch list */
if (sh->batch_head)
goto overlap;
Expand Down
Loading

0 comments on commit 561593a

Please sign in to comment.