Revert "ANDROID: block: Support configuring limits below the page size"
This reverts commit 6e8ff6954a.
Bug: 399192075
Changes related to ANDROID's implementation of small segment size for
block device are being reverted in order to backport upstream accepted
solution at
https://lore.kernel.org/linux-block/20250225022141.2154581-1-ming.lei@redhat.com/
Change-Id: If6954197beb13ddac565392c540bdf1ca6795acf
Signed-off-by: Sandeep Dhavale <dhavale@google.com>
This commit is contained in:
committed by
Carlos Llamas
parent
b7ae5355b0
commit
d76170f735
@@ -263,7 +263,6 @@ static void blk_free_queue_rcu(struct rcu_head *rcu_head)
|
||||
static void blk_free_queue(struct request_queue *q)
|
||||
{
|
||||
blk_free_queue_stats(q->stats);
|
||||
blk_disable_sub_page_limits(&q->limits);
|
||||
if (queue_is_mq(q))
|
||||
blk_mq_release(q);
|
||||
|
||||
|
||||
+5
-59
@@ -19,12 +19,6 @@
|
||||
#include "blk-rq-qos.h"
|
||||
#include "blk-wbt.h"
|
||||
|
||||
|
||||
/* Protects blk_nr_sub_page_limit_queues and blk_sub_page_limits changes. */
|
||||
static DEFINE_MUTEX(blk_sub_page_limit_lock);
|
||||
static uint32_t blk_nr_sub_page_limit_queues;
|
||||
DEFINE_STATIC_KEY_FALSE(blk_sub_page_limits);
|
||||
|
||||
void blk_queue_rq_timeout(struct request_queue *q, unsigned int timeout)
|
||||
{
|
||||
q->rq_timeout = timeout;
|
||||
@@ -225,50 +219,6 @@ unsupported:
|
||||
lim->atomic_write_unit_max = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* blk_enable_sub_page_limits - enable support for limits below the page size
|
||||
* @lim: request queue limits for which to enable support of these features.
|
||||
*
|
||||
* Enable support for max_segment_size values smaller than PAGE_SIZE and for
|
||||
* max_hw_sectors values below PAGE_SIZE >> SECTOR_SHIFT. Support for these
|
||||
* features is not enabled all the time because of the runtime overhead of these
|
||||
* features.
|
||||
*/
|
||||
static void blk_enable_sub_page_limits(struct queue_limits *lim)
|
||||
{
|
||||
if (lim->sub_page_limits)
|
||||
return;
|
||||
|
||||
lim->sub_page_limits = true;
|
||||
|
||||
mutex_lock(&blk_sub_page_limit_lock);
|
||||
if (++blk_nr_sub_page_limit_queues == 1)
|
||||
static_branch_enable(&blk_sub_page_limits);
|
||||
mutex_unlock(&blk_sub_page_limit_lock);
|
||||
}
|
||||
|
||||
/**
|
||||
* blk_disable_sub_page_limits - disable support for limits below the page size
|
||||
* @lim: request queue limits for which to enable support of these features.
|
||||
*
|
||||
* max_segment_size values smaller than PAGE_SIZE and for max_hw_sectors values
|
||||
* below PAGE_SIZE >> SECTOR_SHIFT. Support for these features is not enabled
|
||||
* all the time because of the runtime overhead of these features.
|
||||
*/
|
||||
void blk_disable_sub_page_limits(struct queue_limits *lim)
|
||||
{
|
||||
if (!lim->sub_page_limits)
|
||||
return;
|
||||
|
||||
lim->sub_page_limits = false;
|
||||
|
||||
mutex_lock(&blk_sub_page_limit_lock);
|
||||
WARN_ON_ONCE(blk_nr_sub_page_limit_queues <= 0);
|
||||
if (--blk_nr_sub_page_limit_queues == 0)
|
||||
static_branch_disable(&blk_sub_page_limits);
|
||||
mutex_unlock(&blk_sub_page_limit_lock);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check that the limits in lim are valid, initialize defaults for unset
|
||||
* values, and cap values based on others where needed.
|
||||
@@ -312,13 +262,13 @@ static int blk_validate_limits(struct queue_limits *lim)
|
||||
* value.
|
||||
*
|
||||
* The block layer relies on the fact that every driver can
|
||||
* handle at least a logical_block_size worth of data per I/O,
|
||||
* and needs the value aligned to the logical block size.
|
||||
* handle at lest a page worth of data per I/O, and needs the value
|
||||
* aligned to the logical block size.
|
||||
*/
|
||||
if (!lim->max_hw_sectors)
|
||||
lim->max_hw_sectors = BLK_SAFE_MAX_SECTORS;
|
||||
if (lim->max_hw_sectors < PAGE_SECTORS)
|
||||
blk_enable_sub_page_limits(lim);
|
||||
if (WARN_ON_ONCE(lim->max_hw_sectors < PAGE_SECTORS))
|
||||
return -EINVAL;
|
||||
logical_block_sectors = lim->logical_block_size >> SECTOR_SHIFT;
|
||||
if (WARN_ON_ONCE(logical_block_sectors > lim->max_hw_sectors))
|
||||
return -EINVAL;
|
||||
@@ -393,9 +343,7 @@ static int blk_validate_limits(struct queue_limits *lim)
|
||||
*/
|
||||
if (!lim->max_segment_size)
|
||||
lim->max_segment_size = BLK_MAX_SEGMENT_SIZE;
|
||||
if (lim->max_segment_size < PAGE_SIZE)
|
||||
blk_enable_sub_page_limits(lim);
|
||||
if (WARN_ON_ONCE(lim->max_segment_size < SECTOR_SIZE))
|
||||
if (WARN_ON_ONCE(lim->max_segment_size < PAGE_SIZE))
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -439,8 +387,6 @@ int blk_set_default_limits(struct queue_limits *lim)
|
||||
* initialization to the max value here.
|
||||
*/
|
||||
lim->max_user_discard_sectors = UINT_MAX;
|
||||
/* Set sub_page_limits to false and let validate set it if required */
|
||||
lim->sub_page_limits = false;
|
||||
return blk_validate_limits(lim);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ struct elevator_type;
|
||||
#define BLK_MAX_TIMEOUT (5 * HZ)
|
||||
|
||||
extern struct dentry *blk_debugfs_root;
|
||||
DECLARE_STATIC_KEY_FALSE(blk_sub_page_limits);
|
||||
|
||||
struct blk_flush_queue {
|
||||
spinlock_t mq_flush_lock;
|
||||
@@ -45,12 +44,6 @@ int __bio_queue_enter(struct request_queue *q, struct bio *bio);
|
||||
void submit_bio_noacct_nocheck(struct bio *bio);
|
||||
void bio_await_chain(struct bio *bio);
|
||||
|
||||
static inline bool blk_queue_sub_page_limits(const struct queue_limits *lim)
|
||||
{
|
||||
return static_branch_unlikely(&blk_sub_page_limits) &&
|
||||
lim->sub_page_limits;
|
||||
}
|
||||
void blk_disable_sub_page_limits(struct queue_limits *q);
|
||||
static inline bool blk_try_enter_queue(struct request_queue *q, bool pm)
|
||||
{
|
||||
rcu_read_lock();
|
||||
|
||||
@@ -403,7 +403,6 @@ struct queue_limits {
|
||||
unsigned int dma_pad_mask;
|
||||
|
||||
struct blk_integrity integrity;
|
||||
bool sub_page_limits;
|
||||
};
|
||||
|
||||
typedef int (*report_zones_cb)(struct blk_zone *zone, unsigned int idx,
|
||||
|
||||
Reference in New Issue
Block a user