linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] zram: set BDI_CAP_STABLE_WRITES once
@ 2017-09-12  2:37 Minchan Kim
  2017-09-12  2:37 ` [PATCH 2/5] bdi: introduce BDI_CAP_SYNCHRONOUS_IO Minchan Kim
                   ` (3 more replies)
  0 siblings, 4 replies; 21+ messages in thread
From: Minchan Kim @ 2017-09-12  2:37 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-mm, linux-kernel, kernel-team, Minchan Kim, Ilya Dryomov,
	Sergey Senozhatsky

[1] fixed weird thing(i.e., reset BDI_CAP_STABLE_WRITES flag
unconditionally whenever revalidat_disk is called) so zram doesn't
need to reset the flag any more whenever revalidating the bdev.
Instead, set the flag just once when the zram device is created.

It shouldn't change any behavior.

[1] 19b7ccf8651d, block: get rid of blk_integrity_revalidate()
Cc: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: Minchan Kim <minchan@kernel.org>
---
 drivers/block/zram/zram_drv.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 2981c27d3aae..ba009675fdc0 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -122,14 +122,6 @@ static inline bool is_partial_io(struct bio_vec *bvec)
 }
 #endif
 
-static void zram_revalidate_disk(struct zram *zram)
-{
-	revalidate_disk(zram->disk);
-	/* revalidate_disk reset the BDI_CAP_STABLE_WRITES so set again */
-	zram->disk->queue->backing_dev_info->capabilities |=
-		BDI_CAP_STABLE_WRITES;
-}
-
 /*
  * Check if request is within bounds and aligned on zram logical blocks.
  */
@@ -1385,7 +1377,8 @@ static ssize_t disksize_store(struct device *dev,
 	zram->comp = comp;
 	zram->disksize = disksize;
 	set_capacity(zram->disk, zram->disksize >> SECTOR_SHIFT);
-	zram_revalidate_disk(zram);
+
+	revalidate_disk(zram->disk);
 	up_write(&zram->init_lock);
 
 	return len;
@@ -1432,7 +1425,7 @@ static ssize_t reset_store(struct device *dev,
 	/* Make sure all the pending I/O are finished */
 	fsync_bdev(bdev);
 	zram_reset_device(zram);
-	zram_revalidate_disk(zram);
+	revalidate_disk(zram->disk);
 	bdput(bdev);
 
 	mutex_lock(&bdev->bd_mutex);
@@ -1551,6 +1544,7 @@ static int zram_add(void)
 	/* zram devices sort of resembles non-rotational disks */
 	queue_flag_set_unlocked(QUEUE_FLAG_NONROT, zram->disk->queue);
 	queue_flag_clear_unlocked(QUEUE_FLAG_ADD_RANDOM, zram->disk->queue);
+
 	/*
 	 * To ensure that we always get PAGE_SIZE aligned
 	 * and n*PAGE_SIZED sized I/O requests.
@@ -1575,6 +1569,8 @@ static int zram_add(void)
 	if (ZRAM_LOGICAL_BLOCK_SIZE == PAGE_SIZE)
 		blk_queue_max_write_zeroes_sectors(zram->disk->queue, UINT_MAX);
 
+	zram->disk->queue->backing_dev_info->capabilities |=
+					BDI_CAP_STABLE_WRITES;
 	add_disk(zram->disk);
 
 	ret = sysfs_create_group(&disk_to_dev(zram->disk)->kobj,
-- 
2.7.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2017-09-13  0:55 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-12  2:37 [PATCH 1/5] zram: set BDI_CAP_STABLE_WRITES once Minchan Kim
2017-09-12  2:37 ` [PATCH 2/5] bdi: introduce BDI_CAP_SYNCHRONOUS_IO Minchan Kim
2017-09-12  2:37 ` [PATCH 3/5] mm:swap: introduce SWP_SYNCHRONOUS_IO Minchan Kim
2017-09-12  4:48   ` Sergey Senozhatsky
2017-09-12  2:37 ` [PATCH 4/5] mm:swap: respect page_cluster for readahead Minchan Kim
2017-09-12  5:23   ` Huang, Ying
2017-09-12  6:25     ` Minchan Kim
2017-09-12  6:44       ` Huang, Ying
2017-09-12  6:52         ` Minchan Kim
2017-09-12  7:29           ` Huang, Ying
2017-09-12  7:56             ` Minchan Kim
2017-09-12  8:07               ` Huang, Ying
2017-09-12  8:22                 ` Minchan Kim
2017-09-12  8:32                   ` Huang, Ying
2017-09-12 23:34                     ` Minchan Kim
2017-09-13  0:55                       ` Huang, Ying
2017-09-12  2:37 ` [PATCH 5/5] mm:swap: skip swapcache for swapin of synchronous device Minchan Kim
2017-09-12  6:04   ` Sergey Senozhatsky
2017-09-12  6:31     ` Minchan Kim
2017-09-12 20:22   ` kbuild test robot
2017-09-13  0:16     ` Minchan Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).