|
@@ -25,6 +25,7 @@
|
|
|
#include <linux/genhd.h>
|
|
|
#include <linux/highmem.h>
|
|
|
#include <linux/slab.h>
|
|
|
+#include <linux/backing-dev.h>
|
|
|
#include <linux/string.h>
|
|
|
#include <linux/vmalloc.h>
|
|
|
#include <linux/err.h>
|
|
@@ -112,6 +113,14 @@ static inline bool is_partial_io(struct bio_vec *bvec)
|
|
|
return bvec->bv_len != PAGE_SIZE;
|
|
|
}
|
|
|
|
|
|
+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.
|
|
|
*/
|
|
@@ -1095,7 +1104,7 @@ static ssize_t disksize_store(struct device *dev,
|
|
|
zram->comp = comp;
|
|
|
zram->disksize = disksize;
|
|
|
set_capacity(zram->disk, zram->disksize >> SECTOR_SHIFT);
|
|
|
- revalidate_disk(zram->disk);
|
|
|
+ zram_revalidate_disk(zram);
|
|
|
up_write(&zram->init_lock);
|
|
|
|
|
|
return len;
|
|
@@ -1143,7 +1152,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);
|
|
|
- revalidate_disk(zram->disk);
|
|
|
+ zram_revalidate_disk(zram);
|
|
|
bdput(bdev);
|
|
|
|
|
|
mutex_lock(&bdev->bd_mutex);
|