From 07068613e9685d15e0cd792aa7db483da4c98fde Mon Sep 17 00:00:00 2001 From: lulei1 Date: Thu, 30 Dec 2021 09:42:03 +0800 Subject: [PATCH] mm: zram: fix build error when zram wb disabled fix build error when zram wb disabled Change-Id: I59b1dc0756d10424b76df587d8f9a3f923647882 Signed-off-by: lulei1 Reviewed-on: https://gerrit.mot.com/2157751 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Zhangqing Huang Reviewed-by: Wang Wang Submit-Approved: Jira Key --- drivers/block/zram/zram_drv.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index d57befd3c807..e53a6403d428 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -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 };