Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 38efa146 authored by huangzq2's avatar huangzq2 Committed by Harshit Jain
Browse files

mm: zram: fix build error when zram wb disabled



Change-Id: I0183a3d5ad6b6cc89df3d7ff33bc771f5aca5708
Signed-off-by: default avatarhuangzq2 <huangzq2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1902411


SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: default avatarXiangpo Zhao <zhaoxp3@motorola.com>
Submit-Approved: Jira Key
Signed-off-by: default avatarUtsavBalar1231 <utsavbalar1231@gmail.com>
parent 6b760f93
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -1745,6 +1745,7 @@ static void zram_slot_free_notify(struct block_device *bdev,
/* Moto huangzq2: 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)
{
@@ -1753,16 +1754,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, bool is_write)
@@ -1961,7 +1960,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
};