mirror of
https://github.com/team-infusion-developers/android_kernel_samsung_msm8976.git
synced 2024-09-21 11:53:01 +00:00
mmc: block: Adding device attribute for minimum sectors to start BKOPS
This attribute is used to determine whether the status bit that indicates the need for BKOPS should be checked. The value is stored in this attribute represents the minimum number of sectors that needs to be changed in the device (written or discarded) in order to require the status-bit of BKOPS to be checked Change-Id: I28f72f7114518b165ab3b2f05b75960815705ea6 Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
This commit is contained in:
parent
2d420ffad0
commit
b7921c0af3
|
@ -25,6 +25,15 @@ The following attributes are read/write.
|
|||
running parallel lmdd write and lmdd read operations and calculating
|
||||
the max number of packed writes requests.
|
||||
|
||||
min_sectors_to_check_bkops_status This attribute is used to
|
||||
determine whether the status bit that indicates the need for BKOPS
|
||||
should be checked. The value is stored in this attribute represents
|
||||
the minimum number of sectors that needs to be changed in the device
|
||||
(written or discarded) in order to require the status-bit of BKOPS
|
||||
to be checked. The value can modified via sysfs by writing the
|
||||
required value to:
|
||||
/sys/block/<block_dev_name>/min_sectors_to_check_bkops_status
|
||||
|
||||
SD and MMC Device Attributes
|
||||
============================
|
||||
|
||||
|
|
|
@ -125,6 +125,7 @@ struct mmc_blk_data {
|
|||
struct device_attribute force_ro;
|
||||
struct device_attribute power_ro_lock;
|
||||
struct device_attribute num_wr_reqs_to_start_packing;
|
||||
struct device_attribute min_sectors_to_check_bkops_status;
|
||||
int area_type;
|
||||
};
|
||||
|
||||
|
@ -323,6 +324,48 @@ num_wr_reqs_to_start_packing_store(struct device *dev,
|
|||
return count;
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
min_sectors_to_check_bkops_status_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct mmc_blk_data *md = mmc_blk_get(dev_to_disk(dev));
|
||||
unsigned int min_sectors_to_check_bkops_status;
|
||||
struct mmc_card *card = md->queue.card;
|
||||
int ret;
|
||||
|
||||
if (!card)
|
||||
return -EINVAL;
|
||||
|
||||
min_sectors_to_check_bkops_status =
|
||||
card->bkops_info.min_sectors_to_queue_delayed_work;
|
||||
|
||||
ret = snprintf(buf, PAGE_SIZE, "%d\n",
|
||||
min_sectors_to_check_bkops_status);
|
||||
|
||||
mmc_blk_put(md);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
min_sectors_to_check_bkops_status_store(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
int value;
|
||||
struct mmc_blk_data *md = mmc_blk_get(dev_to_disk(dev));
|
||||
struct mmc_card *card = md->queue.card;
|
||||
|
||||
if (!card)
|
||||
return -EINVAL;
|
||||
|
||||
sscanf(buf, "%d", &value);
|
||||
if (value >= 0)
|
||||
card->bkops_info.min_sectors_to_queue_delayed_work = value;
|
||||
|
||||
mmc_blk_put(md);
|
||||
return count;
|
||||
}
|
||||
|
||||
static int mmc_blk_open(struct block_device *bdev, fmode_t mode)
|
||||
{
|
||||
struct mmc_blk_data *md = mmc_blk_get(bdev->bd_disk);
|
||||
|
@ -2481,6 +2524,19 @@ static int mmc_add_disk(struct mmc_blk_data *md)
|
|||
if (ret)
|
||||
goto power_ro_lock_fail;
|
||||
|
||||
md->min_sectors_to_check_bkops_status.show =
|
||||
min_sectors_to_check_bkops_status_show;
|
||||
md->min_sectors_to_check_bkops_status.store =
|
||||
min_sectors_to_check_bkops_status_store;
|
||||
sysfs_attr_init(&md->min_sectors_to_check_bkops_status.attr);
|
||||
md->min_sectors_to_check_bkops_status.attr.name =
|
||||
"min_sectors_to_check_bkops_status";
|
||||
md->min_sectors_to_check_bkops_status.attr.mode = S_IRUGO | S_IWUSR;
|
||||
ret = device_create_file(disk_to_dev(md->disk),
|
||||
&md->min_sectors_to_check_bkops_status);
|
||||
if (ret)
|
||||
goto power_ro_lock_fail;
|
||||
|
||||
return ret;
|
||||
|
||||
power_ro_lock_fail:
|
||||
|
|
|
@ -298,7 +298,7 @@ void mmc_start_delayed_bkops(struct mmc_card *card)
|
|||
return;
|
||||
|
||||
if (card->bkops_info.sectors_changed <
|
||||
BKOPS_MIN_SECTORS_TO_QUEUE_DELAYED_WORK)
|
||||
card->bkops_info.min_sectors_to_queue_delayed_work)
|
||||
return;
|
||||
|
||||
pr_debug("%s: %s: queueing delayed_bkops_work\n",
|
||||
|
|
|
@ -1422,6 +1422,8 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
|
|||
card->bkops_info.delay_ms,
|
||||
card->bkops_info.host_suspend_tout_ms/2);
|
||||
|
||||
card->bkops_info.min_sectors_to_queue_delayed_work =
|
||||
BKOPS_MIN_SECTORS_TO_QUEUE_DELAYED_WORK;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -265,6 +265,7 @@ struct mmc_bkops_info {
|
|||
struct delayed_work dw;
|
||||
unsigned int host_suspend_tout_ms;
|
||||
unsigned int delay_ms;
|
||||
unsigned int min_sectors_to_queue_delayed_work;
|
||||
/*
|
||||
* A default time for checking the need for non urgent BKOPS once mmcqd
|
||||
* is idle.
|
||||
|
|
Loading…
Reference in a new issue