diff options
-rw-r--r-- | Documentation/ABI/testing/sysfs-class-bdi | 5 | ||||
-rw-r--r-- | block/blk-integrity.c | 4 | ||||
-rw-r--r-- | include/linux/backing-dev.h | 6 | ||||
-rw-r--r-- | mm/backing-dev.c | 11 |
4 files changed, 26 insertions, 0 deletions
diff --git a/Documentation/ABI/testing/sysfs-class-bdi b/Documentation/ABI/testing/sysfs-class-bdi index 5f500977b42f..d773d5697cf5 100644 --- a/Documentation/ABI/testing/sysfs-class-bdi +++ b/Documentation/ABI/testing/sysfs-class-bdi | |||
@@ -48,3 +48,8 @@ max_ratio (read-write) | |||
48 | most of the write-back cache. For example in case of an NFS | 48 | most of the write-back cache. For example in case of an NFS |
49 | mount that is prone to get stuck, or a FUSE mount which cannot | 49 | mount that is prone to get stuck, or a FUSE mount which cannot |
50 | be trusted to play fair. | 50 | be trusted to play fair. |
51 | |||
52 | stable_pages_required (read-only) | ||
53 | |||
54 | If set, the backing device requires that all pages comprising a write | ||
55 | request must not be changed until writeout is complete. | ||
diff --git a/block/blk-integrity.c b/block/blk-integrity.c index da2a818c3a92..dabd221857e1 100644 --- a/block/blk-integrity.c +++ b/block/blk-integrity.c | |||
@@ -420,6 +420,8 @@ int blk_integrity_register(struct gendisk *disk, struct blk_integrity *template) | |||
420 | } else | 420 | } else |
421 | bi->name = bi_unsupported_name; | 421 | bi->name = bi_unsupported_name; |
422 | 422 | ||
423 | disk->queue->backing_dev_info.capabilities |= BDI_CAP_STABLE_WRITES; | ||
424 | |||
423 | return 0; | 425 | return 0; |
424 | } | 426 | } |
425 | EXPORT_SYMBOL(blk_integrity_register); | 427 | EXPORT_SYMBOL(blk_integrity_register); |
@@ -438,6 +440,8 @@ void blk_integrity_unregister(struct gendisk *disk) | |||
438 | if (!disk || !disk->integrity) | 440 | if (!disk || !disk->integrity) |
439 | return; | 441 | return; |
440 | 442 | ||
443 | disk->queue->backing_dev_info.capabilities &= ~BDI_CAP_STABLE_WRITES; | ||
444 | |||
441 | bi = disk->integrity; | 445 | bi = disk->integrity; |
442 | 446 | ||
443 | kobject_uevent(&bi->kobj, KOBJ_REMOVE); | 447 | kobject_uevent(&bi->kobj, KOBJ_REMOVE); |
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index 12731a19ef06..350459910fe1 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h | |||
@@ -254,6 +254,7 @@ int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio); | |||
254 | #define BDI_CAP_EXEC_MAP 0x00000040 | 254 | #define BDI_CAP_EXEC_MAP 0x00000040 |
255 | #define BDI_CAP_NO_ACCT_WB 0x00000080 | 255 | #define BDI_CAP_NO_ACCT_WB 0x00000080 |
256 | #define BDI_CAP_SWAP_BACKED 0x00000100 | 256 | #define BDI_CAP_SWAP_BACKED 0x00000100 |
257 | #define BDI_CAP_STABLE_WRITES 0x00000200 | ||
257 | 258 | ||
258 | #define BDI_CAP_VMFLAGS \ | 259 | #define BDI_CAP_VMFLAGS \ |
259 | (BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP) | 260 | (BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP) |
@@ -308,6 +309,11 @@ long wait_iff_congested(struct zone *zone, int sync, long timeout); | |||
308 | int pdflush_proc_obsolete(struct ctl_table *table, int write, | 309 | int pdflush_proc_obsolete(struct ctl_table *table, int write, |
309 | void __user *buffer, size_t *lenp, loff_t *ppos); | 310 | void __user *buffer, size_t *lenp, loff_t *ppos); |
310 | 311 | ||
312 | static inline bool bdi_cap_stable_pages_required(struct backing_dev_info *bdi) | ||
313 | { | ||
314 | return bdi->capabilities & BDI_CAP_STABLE_WRITES; | ||
315 | } | ||
316 | |||
311 | static inline bool bdi_cap_writeback_dirty(struct backing_dev_info *bdi) | 317 | static inline bool bdi_cap_writeback_dirty(struct backing_dev_info *bdi) |
312 | { | 318 | { |
313 | return !(bdi->capabilities & BDI_CAP_NO_WRITEBACK); | 319 | return !(bdi->capabilities & BDI_CAP_NO_WRITEBACK); |
diff --git a/mm/backing-dev.c b/mm/backing-dev.c index d3ca2b3ee176..41733c5dc820 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c | |||
@@ -221,12 +221,23 @@ static ssize_t max_ratio_store(struct device *dev, | |||
221 | } | 221 | } |
222 | BDI_SHOW(max_ratio, bdi->max_ratio) | 222 | BDI_SHOW(max_ratio, bdi->max_ratio) |
223 | 223 | ||
224 | static ssize_t stable_pages_required_show(struct device *dev, | ||
225 | struct device_attribute *attr, | ||
226 | char *page) | ||
227 | { | ||
228 | struct backing_dev_info *bdi = dev_get_drvdata(dev); | ||
229 | |||
230 | return snprintf(page, PAGE_SIZE-1, "%d\n", | ||
231 | bdi_cap_stable_pages_required(bdi) ? 1 : 0); | ||
232 | } | ||
233 | |||
224 | #define __ATTR_RW(attr) __ATTR(attr, 0644, attr##_show, attr##_store) | 234 | #define __ATTR_RW(attr) __ATTR(attr, 0644, attr##_show, attr##_store) |
225 | 235 | ||
226 | static struct device_attribute bdi_dev_attrs[] = { | 236 | static struct device_attribute bdi_dev_attrs[] = { |
227 | __ATTR_RW(read_ahead_kb), | 237 | __ATTR_RW(read_ahead_kb), |
228 | __ATTR_RW(min_ratio), | 238 | __ATTR_RW(min_ratio), |
229 | __ATTR_RW(max_ratio), | 239 | __ATTR_RW(max_ratio), |
240 | __ATTR_RO(stable_pages_required), | ||
230 | __ATTR_NULL, | 241 | __ATTR_NULL, |
231 | }; | 242 | }; |
232 | 243 | ||