mm: zram: fix build error when zram wb disabled

fix build error 
when zram wb disabled

Change-Id: I59b1dc0756d10424b76df587d8f9a3f923647882
Signed-off-by: lulei1 <lulei1@motorola.com>
Reviewed-on: https://gerrit.mot.com/2157751
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Zhangqing Huang <huangzq2@motorola.com>
Reviewed-by: Wang Wang <wangwang1@lenovo.com>
Submit-Approved: Jira Key
This commit is contained in:
lulei1 authored and Gilberto Gambugge committed 2023-06-01 00:48:51 -03:00
1 parent eb80d2507d
commit 07068613e9
1 file changed
+4 -3
+4 -3
View File
@@ -1755,6 +1755,7 @@ static void zram_slot_free_notify(struct block_device *bdev,
/* Moto lulei1: check sync_io state on swap entry,
* return 0 on wb page, else return 1.
*/
#ifdef CONFIG_ZRAM_WRITEBACK
static int zram_ioctl(struct block_device *bdev, fmode_t mode,
unsigned int cmd, unsigned long index)
{
@@ -1763,16 +1764,14 @@ static int zram_ioctl(struct block_device *bdev, fmode_t mode,
if (cmd != SWP_SYNCHRONOUS_IO) return -EINVAL;
#ifdef CONFIG_ZRAM_WRITEBACK
zram = bdev->bd_disk->private_data;
zram_slot_lock(zram, index);
has_sync_io = zram_test_flag(zram, index, ZRAM_WB) ? 0 : 1;
zram_slot_unlock(zram, index);
#endif
return has_sync_io;
}
#endif
static int zram_rw_page(struct block_device *bdev, sector_t sector,
struct page *page, unsigned int op)
@@ -1966,7 +1965,9 @@ static int zram_open(struct block_device *bdev, fmode_t mode)
static const struct block_device_operations zram_devops = {
.open = zram_open,
.swap_slot_free_notify = zram_slot_free_notify,
#ifdef CONFIG_ZRAM_WRITEBACK
.ioctl = zram_ioctl,
#endif
.rw_page = zram_rw_page,
.owner = THIS_MODULE
};