Skip to content

Commit ce62bd2

Browse files
committed
Merge branch 'for-6.11/block' into for-next
* for-6.11/block: nvme: don't set io_opt if NOWS is zero block: don't reduce max_sectors based on io_opt block: remove a duplicate io_min check in blk_validate_limits blk-wbt: don't throttle swap writes in direct reclaim
2 parents c42a9e3 + f3bf25d commit ce62bd2

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

block/blk-settings.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,11 +276,10 @@ static int blk_validate_limits(struct queue_limits *lim)
276276
if (lim->max_user_sectors < PAGE_SIZE / SECTOR_SIZE)
277277
return -EINVAL;
278278
lim->max_sectors = min(max_hw_sectors, lim->max_user_sectors);
279-
} else if (lim->io_opt) {
279+
} else if (lim->io_opt > (BLK_DEF_MAX_SECTORS_CAP << SECTOR_SHIFT)) {
280280
lim->max_sectors =
281281
min(max_hw_sectors, lim->io_opt >> SECTOR_SHIFT);
282-
} else if (lim->io_min &&
283-
lim->io_min > (BLK_DEF_MAX_SECTORS_CAP << SECTOR_SHIFT)) {
282+
} else if (lim->io_min > (BLK_DEF_MAX_SECTORS_CAP << SECTOR_SHIFT)) {
284283
lim->max_sectors =
285284
min(max_hw_sectors, lim->io_min >> SECTOR_SHIFT);
286285
} else {

block/blk-wbt.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@
3737
enum wbt_flags {
3838
WBT_TRACKED = 1, /* write, tracked for throttling */
3939
WBT_READ = 2, /* read */
40-
WBT_KSWAPD = 4, /* write, from kswapd */
40+
WBT_SWAP = 4, /* write, from swap_writepage() */
4141
WBT_DISCARD = 8, /* discard */
4242

4343
WBT_NR_BITS = 4, /* number of bits */
4444
};
4545

4646
enum {
4747
WBT_RWQ_BG = 0,
48-
WBT_RWQ_KSWAPD,
48+
WBT_RWQ_SWAP,
4949
WBT_RWQ_DISCARD,
5050
WBT_NUM_RWQ,
5151
};
@@ -172,8 +172,8 @@ static bool wb_recent_wait(struct rq_wb *rwb)
172172
static inline struct rq_wait *get_rq_wait(struct rq_wb *rwb,
173173
enum wbt_flags wb_acct)
174174
{
175-
if (wb_acct & WBT_KSWAPD)
176-
return &rwb->rq_wait[WBT_RWQ_KSWAPD];
175+
if (wb_acct & WBT_SWAP)
176+
return &rwb->rq_wait[WBT_RWQ_SWAP];
177177
else if (wb_acct & WBT_DISCARD)
178178
return &rwb->rq_wait[WBT_RWQ_DISCARD];
179179

@@ -528,7 +528,7 @@ static bool close_io(struct rq_wb *rwb)
528528
time_before(now, rwb->last_comp + HZ / 10);
529529
}
530530

531-
#define REQ_HIPRIO (REQ_SYNC | REQ_META | REQ_PRIO)
531+
#define REQ_HIPRIO (REQ_SYNC | REQ_META | REQ_PRIO | REQ_SWAP)
532532

533533
static inline unsigned int get_limit(struct rq_wb *rwb, blk_opf_t opf)
534534
{
@@ -539,13 +539,13 @@ static inline unsigned int get_limit(struct rq_wb *rwb, blk_opf_t opf)
539539

540540
/*
541541
* At this point we know it's a buffered write. If this is
542-
* kswapd trying to free memory, or REQ_SYNC is set, then
542+
* swap trying to free memory, or REQ_SYNC is set, then
543543
* it's WB_SYNC_ALL writeback, and we'll use the max limit for
544544
* that. If the write is marked as a background write, then use
545545
* the idle limit, or go to normal if we haven't had competing
546546
* IO for a bit.
547547
*/
548-
if ((opf & REQ_HIPRIO) || wb_recent_wait(rwb) || current_is_kswapd())
548+
if ((opf & REQ_HIPRIO) || wb_recent_wait(rwb))
549549
limit = rwb->rq_depth.max_depth;
550550
else if ((opf & REQ_BACKGROUND) || close_io(rwb)) {
551551
/*
@@ -622,8 +622,8 @@ static enum wbt_flags bio_to_wbt_flags(struct rq_wb *rwb, struct bio *bio)
622622
if (bio_op(bio) == REQ_OP_READ) {
623623
flags = WBT_READ;
624624
} else if (wbt_should_throttle(bio)) {
625-
if (current_is_kswapd())
626-
flags |= WBT_KSWAPD;
625+
if (bio->bi_opf & REQ_SWAP)
626+
flags |= WBT_SWAP;
627627
if (bio_op(bio) == REQ_OP_DISCARD)
628628
flags |= WBT_DISCARD;
629629
flags |= WBT_TRACKED;

drivers/nvme/host/core.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2025,7 +2025,8 @@ static bool nvme_update_disk_info(struct nvme_ns *ns, struct nvme_id_ns *id,
20252025
/* NPWG = Namespace Preferred Write Granularity */
20262026
phys_bs = bs * (1 + le16_to_cpu(id->npwg));
20272027
/* NOWS = Namespace Optimal Write Size */
2028-
io_opt = bs * (1 + le16_to_cpu(id->nows));
2028+
if (id->nows)
2029+
io_opt = bs * (1 + le16_to_cpu(id->nows));
20292030
}
20302031

20312032
/*

0 commit comments

Comments
 (0)