aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2008-04-30 03:54:32 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-30 11:29:49 -0400
commitcf0ca9fe5dd9e3693d935757a7b2fc50fc576554 (patch)
treec795c5271eda9fc67579fa3176c646b892dfdb41 /block
parentcaafa4324335aeb11bc233d5f87aca8cce30beba (diff)
mm: bdi: export BDI attributes in sysfs
Provide a place in sysfs (/sys/class/bdi) for the backing_dev_info object. This allows us to see and set the various BDI specific variables. In particular this properly exposes the read-ahead window for all relevant users and /sys/block/<block>/queue/read_ahead_kb should be deprecated. With patient help from Kay Sievers and Greg KH [mszeredi@suse.cz] - split off NFS and FUSE changes into separate patches - document new sysfs attributes under Documentation/ABI - do bdi_class_init as a core_initcall, otherwise the "default" BDI won't be initialized - remove bdi_init_fmt macro, it's not used very much [akpm@linux-foundation.org: fix ia64 warning] Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Kay Sievers <kay.sievers@vrfy.org> Acked-by: Greg KH <greg@kroah.com> Cc: Trond Myklebust <trond.myklebust@fys.uio.no> Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'block')
-rw-r--r--block/genhd.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/block/genhd.c b/block/genhd.c
index 00da5219ee37..fda9c7a63c29 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -182,11 +182,17 @@ static int exact_lock(dev_t devt, void *data)
182 */ 182 */
183void add_disk(struct gendisk *disk) 183void add_disk(struct gendisk *disk)
184{ 184{
185 struct backing_dev_info *bdi;
186
185 disk->flags |= GENHD_FL_UP; 187 disk->flags |= GENHD_FL_UP;
186 blk_register_region(MKDEV(disk->major, disk->first_minor), 188 blk_register_region(MKDEV(disk->major, disk->first_minor),
187 disk->minors, NULL, exact_match, exact_lock, disk); 189 disk->minors, NULL, exact_match, exact_lock, disk);
188 register_disk(disk); 190 register_disk(disk);
189 blk_register_queue(disk); 191 blk_register_queue(disk);
192
193 bdi = &disk->queue->backing_dev_info;
194 bdi_register_dev(bdi, MKDEV(disk->major, disk->first_minor));
195 sysfs_create_link(&disk->dev.kobj, &bdi->dev->kobj, "bdi");
190} 196}
191 197
192EXPORT_SYMBOL(add_disk); 198EXPORT_SYMBOL(add_disk);
@@ -194,6 +200,8 @@ EXPORT_SYMBOL(del_gendisk); /* in partitions/check.c */
194 200
195void unlink_gendisk(struct gendisk *disk) 201void unlink_gendisk(struct gendisk *disk)
196{ 202{
203 sysfs_remove_link(&disk->dev.kobj, "bdi");
204 bdi_unregister(&disk->queue->backing_dev_info);
197 blk_unregister_queue(disk); 205 blk_unregister_queue(disk);
198 blk_unregister_region(MKDEV(disk->major, disk->first_minor), 206 blk_unregister_region(MKDEV(disk->major, disk->first_minor),
199 disk->minors); 207 disk->minors);