Skip to content

Commit

Permalink
fs: erofs: Guard blk_throtl_get_quota() calls with CONFIG_BLK_DEV_THR…
Browse files Browse the repository at this point in the history
…OTTLING

* In Huawei P10 HMOS2.0 kernel, blk_throtl_get_quota() is provided by CONFIG_BLK_DEV_THROTTLING
* When CONFIG_BLK_DEV_THROTTLING is disabled, the function just returns true, seems to be unnecessary
* CONFIG_BLK_DEV_THROTTLING doesn't exist here, just guard it

Change-Id: I885f57686679beebe30c85be42bfc9f922f520ae
  • Loading branch information
me-cafebabe authored and AkiraNoSushi committed Mar 12, 2023
1 parent 2476e38 commit 8b521ff
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions fs/erofs/unzip_vle.c
Original file line number Diff line number Diff line change
Expand Up @@ -1631,7 +1631,9 @@ static int z_erofs_vle_normalaccess_readpages(struct file *filp,
unsigned int nr_pages)
{
struct inode *const inode = mapping->host;
#ifdef CONFIG_BLK_DEV_THROTTLING
struct block_device *bdev = inode->i_sb->s_bdev;
#endif
struct erofs_sb_info *const sbi = EROFS_I_SB(inode);

bool sync = __should_decompress_synchronously(sbi, nr_pages);
Expand All @@ -1643,6 +1645,7 @@ static int z_erofs_vle_normalaccess_readpages(struct file *filp,

trace_erofs_readpages(mapping->host, lru_to_page(pages), nr_pages, false);

#ifdef CONFIG_BLK_DEV_THROTTLING
if (pages) {
/*
* Get one quota before read pages, when this ends,
Expand All @@ -1652,6 +1655,7 @@ static int z_erofs_vle_normalaccess_readpages(struct file *filp,
blk_throtl_get_quota(bdev, PAGE_SIZE,
msecs_to_jiffies(100), true);
}
#endif

#if (EROFS_FS_ZIP_CACHE_LVL >= 2)
f.cachedzone_la = lru_to_page(pages)->index << PAGE_SHIFT;
Expand Down Expand Up @@ -1707,10 +1711,12 @@ static int z_erofs_vle_normalaccess_readpages(struct file *filp,
/* clean up the remaining free pages */
put_pages_list(&pagepool);

#ifdef CONFIG_BLK_DEV_THROTTLING
if (io_submitted)
while (--io_submitted)
blk_throtl_get_quota(bdev, PAGE_SIZE,
msecs_to_jiffies(100), true);
#endif
return 0;
}

Expand Down

0 comments on commit 8b521ff

Please sign in to comment.