Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block

* 'for-linus' of git://git.kernel.dk/linux-2.6-block:
coda: move backing-dev.h kernel include inside __KERNEL__
mtd: ensure that bdi entries are properly initialized and registered
Move mtd_bdi_*mappable to mtdcore.c
btrfs: convert to using bdi_setup_and_register()
Catch filesystems lacking s_bdi
drbd: Terminate a connection early if sending the protocol fails
drbd: fix memory leak
Fix JFFS2 sync silent failure
smbfs: add bdi backing to mount session
ncpfs: add bdi backing to mount session
exofs: add bdi backing to mount session
ecryptfs: add bdi backing to mount session
coda: add bdi backing to mount session
cifs: add bdi backing to mount session
afs: add bdi backing to mount session.
9p: add bdi backing to mount session
bdi: add helper function for doing init and register of a bdi for a file system
block: ensure jiffies wrap is handled correctly in blk_rq_timed_out_timer

+220 -91
+5 -7
block/blk-timeout.c
··· 109 struct request_queue *q = (struct request_queue *) data; 110 unsigned long flags, next = 0; 111 struct request *rq, *tmp; 112 113 spin_lock_irqsave(q->queue_lock, flags); 114 ··· 123 if (blk_mark_rq_complete(rq)) 124 continue; 125 blk_rq_timed_out(rq); 126 - } else if (!next || time_after(next, rq->deadline)) 127 next = rq->deadline; 128 } 129 130 - /* 131 - * next can never be 0 here with the list non-empty, since we always 132 - * bump ->deadline to 1 so we can detect if the timer was ever added 133 - * or not. See comment in blk_add_timer() 134 - */ 135 - if (next) 136 mod_timer(&q->timeout, round_jiffies_up(next)); 137 138 spin_unlock_irqrestore(q->queue_lock, flags);
··· 109 struct request_queue *q = (struct request_queue *) data; 110 unsigned long flags, next = 0; 111 struct request *rq, *tmp; 112 + int next_set = 0; 113 114 spin_lock_irqsave(q->queue_lock, flags); 115 ··· 122 if (blk_mark_rq_complete(rq)) 123 continue; 124 blk_rq_timed_out(rq); 125 + } else if (!next_set || time_after(next, rq->deadline)) { 126 next = rq->deadline; 127 + next_set = 1; 128 + } 129 } 130 131 + if (next_set) 132 mod_timer(&q->timeout, round_jiffies_up(next)); 133 134 spin_unlock_irqrestore(q->queue_lock, flags);
+1
drivers/block/drbd/drbd_main.c
··· 1695 cf |= CF_DRY_RUN; 1696 else { 1697 dev_err(DEV, "--dry-run is not supported by peer"); 1698 return 0; 1699 } 1700 }
··· 1695 cf |= CF_DRY_RUN; 1696 else { 1697 dev_err(DEV, "--dry-run is not supported by peer"); 1698 + kfree(p); 1699 return 0; 1700 } 1701 }
+2 -1
drivers/block/drbd/drbd_receiver.c
··· 899 900 drbd_thread_start(&mdev->asender); 901 902 - drbd_send_protocol(mdev); 903 drbd_send_sync_param(mdev, &mdev->sync_conf); 904 drbd_send_sizes(mdev, 0); 905 drbd_send_uuids(mdev);
··· 899 900 drbd_thread_start(&mdev->asender); 901 902 + if (!drbd_send_protocol(mdev)) 903 + return -1; 904 drbd_send_sync_param(mdev, &mdev->sync_conf); 905 drbd_send_sizes(mdev, 0); 906 drbd_send_uuids(mdev);
+1 -1
drivers/mtd/Makefile
··· 4 5 # Core functionality. 6 obj-$(CONFIG_MTD) += mtd.o 7 - mtd-y := mtdcore.o mtdsuper.o mtdbdi.o 8 mtd-$(CONFIG_MTD_PARTITIONS) += mtdpart.o 9 10 obj-$(CONFIG_MTD_CONCAT) += mtdconcat.o
··· 4 5 # Core functionality. 6 obj-$(CONFIG_MTD) += mtd.o 7 + mtd-y := mtdcore.o mtdsuper.o 8 mtd-$(CONFIG_MTD_PARTITIONS) += mtdpart.o 9 10 obj-$(CONFIG_MTD_CONCAT) += mtdconcat.o
-17
drivers/mtd/internal.h
··· 1 - /* Internal MTD definitions 2 - * 3 - * Copyright © 2006 Red Hat, Inc. All Rights Reserved. 4 - * Written by David Howells (dhowells@redhat.com) 5 - * 6 - * This program is free software; you can redistribute it and/or 7 - * modify it under the terms of the GNU General Public License 8 - * as published by the Free Software Foundation; either version 9 - * 2 of the License, or (at your option) any later version. 10 - */ 11 - 12 - /* 13 - * mtdbdi.c 14 - */ 15 - extern struct backing_dev_info mtd_bdi_unmappable; 16 - extern struct backing_dev_info mtd_bdi_ro_mappable; 17 - extern struct backing_dev_info mtd_bdi_rw_mappable;
···
-43
drivers/mtd/mtdbdi.c
··· 1 - /* MTD backing device capabilities 2 - * 3 - * Copyright © 2006 Red Hat, Inc. All Rights Reserved. 4 - * Written by David Howells (dhowells@redhat.com) 5 - * 6 - * This program is free software; you can redistribute it and/or 7 - * modify it under the terms of the GNU General Public License 8 - * as published by the Free Software Foundation; either version 9 - * 2 of the License, or (at your option) any later version. 10 - */ 11 - 12 - #include <linux/backing-dev.h> 13 - #include <linux/mtd/mtd.h> 14 - #include "internal.h" 15 - 16 - /* 17 - * backing device capabilities for non-mappable devices (such as NAND flash) 18 - * - permits private mappings, copies are taken of the data 19 - */ 20 - struct backing_dev_info mtd_bdi_unmappable = { 21 - .capabilities = BDI_CAP_MAP_COPY, 22 - }; 23 - 24 - /* 25 - * backing device capabilities for R/O mappable devices (such as ROM) 26 - * - permits private mappings, copies are taken of the data 27 - * - permits non-writable shared mappings 28 - */ 29 - struct backing_dev_info mtd_bdi_ro_mappable = { 30 - .capabilities = (BDI_CAP_MAP_COPY | BDI_CAP_MAP_DIRECT | 31 - BDI_CAP_EXEC_MAP | BDI_CAP_READ_MAP), 32 - }; 33 - 34 - /* 35 - * backing device capabilities for writable mappable devices (such as RAM) 36 - * - permits private mappings, copies are taken of the data 37 - * - permits non-writable shared mappings 38 - */ 39 - struct backing_dev_info mtd_bdi_rw_mappable = { 40 - .capabilities = (BDI_CAP_MAP_COPY | BDI_CAP_MAP_DIRECT | 41 - BDI_CAP_EXEC_MAP | BDI_CAP_READ_MAP | 42 - BDI_CAP_WRITE_MAP), 43 - };
···
+75 -6
drivers/mtd/mtdcore.c
··· 2 * Core registration and callback routines for MTD 3 * drivers and users. 4 * 5 */ 6 7 #include <linux/module.h> ··· 19 #include <linux/init.h> 20 #include <linux/mtd/compatmac.h> 21 #include <linux/proc_fs.h> 22 23 #include <linux/mtd/mtd.h> 24 - #include "internal.h" 25 26 #include "mtdcore.h" 27 28 static int mtd_cls_suspend(struct device *dev, pm_message_t state); 29 static int mtd_cls_resume(struct device *dev); ··· 659 /*====================================================================*/ 660 /* Init code */ 661 662 static int __init init_mtd(void) 663 { 664 int ret; 665 - ret = class_register(&mtd_class); 666 667 - if (ret) { 668 - pr_err("Error registering mtd class: %d\n", ret); 669 - return ret; 670 - } 671 #ifdef CONFIG_PROC_FS 672 if ((proc_mtd = create_proc_entry( "mtd", 0, NULL ))) 673 proc_mtd->read_proc = mtd_read_proc; 674 #endif /* CONFIG_PROC_FS */ 675 return 0; 676 } 677 678 static void __exit cleanup_mtd(void) ··· 717 remove_proc_entry( "mtd", NULL); 718 #endif /* CONFIG_PROC_FS */ 719 class_unregister(&mtd_class); 720 } 721 722 module_init(init_mtd);
··· 2 * Core registration and callback routines for MTD 3 * drivers and users. 4 * 5 + * bdi bits are: 6 + * Copyright © 2006 Red Hat, Inc. All Rights Reserved. 7 + * Written by David Howells (dhowells@redhat.com) 8 */ 9 10 #include <linux/module.h> ··· 16 #include <linux/init.h> 17 #include <linux/mtd/compatmac.h> 18 #include <linux/proc_fs.h> 19 + #include <linux/backing-dev.h> 20 21 #include <linux/mtd/mtd.h> 22 23 #include "mtdcore.h" 24 + /* 25 + * backing device capabilities for non-mappable devices (such as NAND flash) 26 + * - permits private mappings, copies are taken of the data 27 + */ 28 + struct backing_dev_info mtd_bdi_unmappable = { 29 + .capabilities = BDI_CAP_MAP_COPY, 30 + }; 31 + 32 + /* 33 + * backing device capabilities for R/O mappable devices (such as ROM) 34 + * - permits private mappings, copies are taken of the data 35 + * - permits non-writable shared mappings 36 + */ 37 + struct backing_dev_info mtd_bdi_ro_mappable = { 38 + .capabilities = (BDI_CAP_MAP_COPY | BDI_CAP_MAP_DIRECT | 39 + BDI_CAP_EXEC_MAP | BDI_CAP_READ_MAP), 40 + }; 41 + 42 + /* 43 + * backing device capabilities for writable mappable devices (such as RAM) 44 + * - permits private mappings, copies are taken of the data 45 + * - permits non-writable shared mappings 46 + */ 47 + struct backing_dev_info mtd_bdi_rw_mappable = { 48 + .capabilities = (BDI_CAP_MAP_COPY | BDI_CAP_MAP_DIRECT | 49 + BDI_CAP_EXEC_MAP | BDI_CAP_READ_MAP | 50 + BDI_CAP_WRITE_MAP), 51 + }; 52 53 static int mtd_cls_suspend(struct device *dev, pm_message_t state); 54 static int mtd_cls_resume(struct device *dev); ··· 628 /*====================================================================*/ 629 /* Init code */ 630 631 + static int __init mtd_bdi_init(struct backing_dev_info *bdi, const char *name) 632 + { 633 + int ret; 634 + 635 + ret = bdi_init(bdi); 636 + if (!ret) 637 + ret = bdi_register(bdi, NULL, name); 638 + 639 + if (ret) 640 + bdi_destroy(bdi); 641 + 642 + return ret; 643 + } 644 + 645 static int __init init_mtd(void) 646 { 647 int ret; 648 649 + ret = class_register(&mtd_class); 650 + if (ret) 651 + goto err_reg; 652 + 653 + ret = mtd_bdi_init(&mtd_bdi_unmappable, "mtd-unmap"); 654 + if (ret) 655 + goto err_bdi1; 656 + 657 + ret = mtd_bdi_init(&mtd_bdi_ro_mappable, "mtd-romap"); 658 + if (ret) 659 + goto err_bdi2; 660 + 661 + ret = mtd_bdi_init(&mtd_bdi_rw_mappable, "mtd-rwmap"); 662 + if (ret) 663 + goto err_bdi3; 664 + 665 #ifdef CONFIG_PROC_FS 666 if ((proc_mtd = create_proc_entry( "mtd", 0, NULL ))) 667 proc_mtd->read_proc = mtd_read_proc; 668 #endif /* CONFIG_PROC_FS */ 669 return 0; 670 + 671 + err_bdi3: 672 + bdi_destroy(&mtd_bdi_ro_mappable); 673 + err_bdi2: 674 + bdi_destroy(&mtd_bdi_unmappable); 675 + err_bdi1: 676 + class_unregister(&mtd_class); 677 + err_reg: 678 + pr_err("Error registering mtd class or bdi: %d\n", ret); 679 + return ret; 680 } 681 682 static void __exit cleanup_mtd(void) ··· 651 remove_proc_entry( "mtd", NULL); 652 #endif /* CONFIG_PROC_FS */ 653 class_unregister(&mtd_class); 654 + bdi_destroy(&mtd_bdi_unmappable); 655 + bdi_destroy(&mtd_bdi_ro_mappable); 656 + bdi_destroy(&mtd_bdi_rw_mappable); 657 } 658 659 module_init(init_mtd);
+2
drivers/mtd/mtdsuper.c
··· 13 #include <linux/mtd/super.h> 14 #include <linux/namei.h> 15 #include <linux/ctype.h> 16 17 /* 18 * compare superblocks to see if they're equivalent ··· 45 46 sb->s_mtd = mtd; 47 sb->s_dev = MKDEV(MTD_BLOCK_MAJOR, mtd->index); 48 return 0; 49 } 50
··· 13 #include <linux/mtd/super.h> 14 #include <linux/namei.h> 15 #include <linux/ctype.h> 16 + #include <linux/slab.h> 17 18 /* 19 * compare superblocks to see if they're equivalent ··· 44 45 sb->s_mtd = mtd; 46 sb->s_dev = MKDEV(MTD_BLOCK_MAJOR, mtd->index); 47 + sb->s_bdi = mtd->backing_dev_info; 48 return 0; 49 } 50
+10
fs/9p/v9fs.c
··· 238 return ERR_PTR(-ENOMEM); 239 } 240 241 spin_lock(&v9fs_sessionlist_lock); 242 list_add(&v9ses->slist, &v9fs_sessionlist); 243 spin_unlock(&v9fs_sessionlist_lock); ··· 308 return fid; 309 310 error: 311 return ERR_PTR(retval); 312 } 313 ··· 333 #endif 334 __putname(v9ses->uname); 335 __putname(v9ses->aname); 336 337 spin_lock(&v9fs_sessionlist_lock); 338 list_del(&v9ses->slist);
··· 238 return ERR_PTR(-ENOMEM); 239 } 240 241 + rc = bdi_setup_and_register(&v9ses->bdi, "9p", BDI_CAP_MAP_COPY); 242 + if (rc) { 243 + __putname(v9ses->aname); 244 + __putname(v9ses->uname); 245 + return ERR_PTR(rc); 246 + } 247 + 248 spin_lock(&v9fs_sessionlist_lock); 249 list_add(&v9ses->slist, &v9fs_sessionlist); 250 spin_unlock(&v9fs_sessionlist_lock); ··· 301 return fid; 302 303 error: 304 + bdi_destroy(&v9ses->bdi); 305 return ERR_PTR(retval); 306 } 307 ··· 325 #endif 326 __putname(v9ses->uname); 327 __putname(v9ses->aname); 328 + 329 + bdi_destroy(&v9ses->bdi); 330 331 spin_lock(&v9fs_sessionlist_lock); 332 list_del(&v9ses->slist);
+2
fs/9p/v9fs.h
··· 20 * Boston, MA 02111-1301 USA 21 * 22 */ 23 24 /** 25 * enum p9_session_flags - option flags for each 9P session ··· 103 u32 uid; /* if ACCESS_SINGLE, the uid that has access */ 104 struct p9_client *clnt; /* 9p client */ 105 struct list_head slist; /* list of sessions registered with v9fs */ 106 }; 107 108 struct p9_fid *v9fs_session_init(struct v9fs_session_info *, const char *,
··· 20 * Boston, MA 02111-1301 USA 21 * 22 */ 23 + #include <linux/backing-dev.h> 24 25 /** 26 * enum p9_session_flags - option flags for each 9P session ··· 102 u32 uid; /* if ACCESS_SINGLE, the uid that has access */ 103 struct p9_client *clnt; /* 9p client */ 104 struct list_head slist; /* list of sessions registered with v9fs */ 105 + struct backing_dev_info bdi; 106 }; 107 108 struct p9_fid *v9fs_session_init(struct v9fs_session_info *, const char *,
+1
fs/9p/vfs_super.c
··· 77 sb->s_blocksize = 1 << sb->s_blocksize_bits; 78 sb->s_magic = V9FS_MAGIC; 79 sb->s_op = &v9fs_super_ops; 80 81 sb->s_flags = flags | MS_ACTIVE | MS_SYNCHRONOUS | MS_DIRSYNC | 82 MS_NOATIME;
··· 77 sb->s_blocksize = 1 << sb->s_blocksize_bits; 78 sb->s_magic = V9FS_MAGIC; 79 sb->s_op = &v9fs_super_ops; 80 + sb->s_bdi = &v9ses->bdi; 81 82 sb->s_flags = flags | MS_ACTIVE | MS_SYNCHRONOUS | MS_DIRSYNC | 83 MS_NOATIME;
+2
fs/afs/internal.h
··· 19 #include <linux/workqueue.h> 20 #include <linux/sched.h> 21 #include <linux/fscache.h> 22 23 #include "afs.h" 24 #include "afs_vl.h" ··· 314 unsigned short rjservers; /* number of servers discarded due to -ENOMEDIUM */ 315 struct afs_server *servers[8]; /* servers on which volume resides (ordered) */ 316 struct rw_semaphore server_sem; /* lock for accessing current server */ 317 }; 318 319 /*
··· 19 #include <linux/workqueue.h> 20 #include <linux/sched.h> 21 #include <linux/fscache.h> 22 + #include <linux/backing-dev.h> 23 24 #include "afs.h" 25 #include "afs_vl.h" ··· 313 unsigned short rjservers; /* number of servers discarded due to -ENOMEDIUM */ 314 struct afs_server *servers[8]; /* servers on which volume resides (ordered) */ 315 struct rw_semaphore server_sem; /* lock for accessing current server */ 316 + struct backing_dev_info bdi; 317 }; 318 319 /*
+1
fs/afs/super.c
··· 311 sb->s_magic = AFS_FS_MAGIC; 312 sb->s_op = &afs_super_ops; 313 sb->s_fs_info = as; 314 315 /* allocate the root inode and dentry */ 316 fid.vid = as->volume->vid;
··· 311 sb->s_magic = AFS_FS_MAGIC; 312 sb->s_op = &afs_super_ops; 313 sb->s_fs_info = as; 314 + sb->s_bdi = &as->volume->bdi; 315 316 /* allocate the root inode and dentry */ 317 fid.vid = as->volume->vid;
+7
fs/afs/volume.c
··· 106 volume->cell = params->cell; 107 volume->vid = vlocation->vldb.vid[params->type]; 108 109 init_rwsem(&volume->server_sem); 110 111 /* look up all the applicable server records */ ··· 155 return ERR_PTR(ret); 156 157 error_discard: 158 up_write(&params->cell->vl_sem); 159 160 for (loop = volume->nservers - 1; loop >= 0; loop--) ··· 206 for (loop = volume->nservers - 1; loop >= 0; loop--) 207 afs_put_server(volume->servers[loop]); 208 209 kfree(volume); 210 211 _leave(" [destroyed]");
··· 106 volume->cell = params->cell; 107 volume->vid = vlocation->vldb.vid[params->type]; 108 109 + ret = bdi_setup_and_register(&volume->bdi, "afs", BDI_CAP_MAP_COPY); 110 + if (ret) 111 + goto error_bdi; 112 + 113 init_rwsem(&volume->server_sem); 114 115 /* look up all the applicable server records */ ··· 151 return ERR_PTR(ret); 152 153 error_discard: 154 + bdi_destroy(&volume->bdi); 155 + error_bdi: 156 up_write(&params->cell->vl_sem); 157 158 for (loop = volume->nservers - 1; loop >= 0; loop--) ··· 200 for (loop = volume->nservers - 1; loop >= 0; loop--) 201 afs_put_server(volume->servers[loop]); 202 203 + bdi_destroy(&volume->bdi); 204 kfree(volume); 205 206 _leave(" [destroyed]");
+1 -11
fs/btrfs/disk-io.c
··· 44 static void end_workqueue_fn(struct btrfs_work *work); 45 static void free_fs_root(struct btrfs_root *root); 46 47 - static atomic_t btrfs_bdi_num = ATOMIC_INIT(0); 48 - 49 /* 50 * end_io_wq structs are used to do processing in task context when an IO is 51 * complete. This is used during reads to verify checksums, and it is used ··· 1373 { 1374 int err; 1375 1376 - bdi->name = "btrfs"; 1377 bdi->capabilities = BDI_CAP_MAP_COPY; 1378 - err = bdi_init(bdi); 1379 if (err) 1380 return err; 1381 - 1382 - err = bdi_register(bdi, NULL, "btrfs-%d", 1383 - atomic_inc_return(&btrfs_bdi_num)); 1384 - if (err) { 1385 - bdi_destroy(bdi); 1386 - return err; 1387 - } 1388 1389 bdi->ra_pages = default_backing_dev_info.ra_pages; 1390 bdi->unplug_io_fn = btrfs_unplug_io_fn;
··· 44 static void end_workqueue_fn(struct btrfs_work *work); 45 static void free_fs_root(struct btrfs_root *root); 46 47 /* 48 * end_io_wq structs are used to do processing in task context when an IO is 49 * complete. This is used during reads to verify checksums, and it is used ··· 1375 { 1376 int err; 1377 1378 bdi->capabilities = BDI_CAP_MAP_COPY; 1379 + err = bdi_setup_and_register(bdi, "btrfs", BDI_CAP_MAP_COPY); 1380 if (err) 1381 return err; 1382 1383 bdi->ra_pages = default_backing_dev_info.ra_pages; 1384 bdi->unplug_io_fn = btrfs_unplug_io_fn;
+3
fs/cifs/cifs_fs_sb.h
··· 18 #ifndef _CIFS_FS_SB_H 19 #define _CIFS_FS_SB_H 20 21 #define CIFS_MOUNT_NO_PERM 1 /* do not do client vfs_perm check */ 22 #define CIFS_MOUNT_SET_UID 2 /* set current's euid in create etc. */ 23 #define CIFS_MOUNT_SERVER_INUM 4 /* inode numbers from uniqueid from server */ ··· 52 #ifdef CONFIG_CIFS_DFS_UPCALL 53 char *mountdata; /* mount options received at mount time */ 54 #endif 55 }; 56 #endif /* _CIFS_FS_SB_H */
··· 18 #ifndef _CIFS_FS_SB_H 19 #define _CIFS_FS_SB_H 20 21 + #include <linux/backing-dev.h> 22 + 23 #define CIFS_MOUNT_NO_PERM 1 /* do not do client vfs_perm check */ 24 #define CIFS_MOUNT_SET_UID 2 /* set current's euid in create etc. */ 25 #define CIFS_MOUNT_SERVER_INUM 4 /* inode numbers from uniqueid from server */ ··· 50 #ifdef CONFIG_CIFS_DFS_UPCALL 51 char *mountdata; /* mount options received at mount time */ 52 #endif 53 + struct backing_dev_info bdi; 54 }; 55 #endif /* _CIFS_FS_SB_H */
+10
fs/cifs/cifsfs.c
··· 103 if (cifs_sb == NULL) 104 return -ENOMEM; 105 106 #ifdef CONFIG_CIFS_DFS_UPCALL 107 /* copy mount params to sb for use in submounts */ 108 /* BB: should we move this after the mount so we ··· 121 int len = strlen(data); 122 cifs_sb->mountdata = kzalloc(len + 1, GFP_KERNEL); 123 if (cifs_sb->mountdata == NULL) { 124 kfree(sb->s_fs_info); 125 sb->s_fs_info = NULL; 126 return -ENOMEM; ··· 142 143 sb->s_magic = CIFS_MAGIC_NUMBER; 144 sb->s_op = &cifs_super_ops; 145 /* if (cifs_sb->tcon->ses->server->maxBuf > MAX_CIFS_HDR_SIZE + 512) 146 sb->s_blocksize = 147 cifs_sb->tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE; */ ··· 191 } 192 #endif 193 unload_nls(cifs_sb->local_nls); 194 kfree(cifs_sb); 195 } 196 return rc; ··· 223 #endif 224 225 unload_nls(cifs_sb->local_nls); 226 kfree(cifs_sb); 227 228 unlock_kernel();
··· 103 if (cifs_sb == NULL) 104 return -ENOMEM; 105 106 + rc = bdi_setup_and_register(&cifs_sb->bdi, "cifs", BDI_CAP_MAP_COPY); 107 + if (rc) { 108 + kfree(cifs_sb); 109 + return rc; 110 + } 111 + 112 #ifdef CONFIG_CIFS_DFS_UPCALL 113 /* copy mount params to sb for use in submounts */ 114 /* BB: should we move this after the mount so we ··· 115 int len = strlen(data); 116 cifs_sb->mountdata = kzalloc(len + 1, GFP_KERNEL); 117 if (cifs_sb->mountdata == NULL) { 118 + bdi_destroy(&cifs_sb->bdi); 119 kfree(sb->s_fs_info); 120 sb->s_fs_info = NULL; 121 return -ENOMEM; ··· 135 136 sb->s_magic = CIFS_MAGIC_NUMBER; 137 sb->s_op = &cifs_super_ops; 138 + sb->s_bdi = &cifs_sb->bdi; 139 /* if (cifs_sb->tcon->ses->server->maxBuf > MAX_CIFS_HDR_SIZE + 512) 140 sb->s_blocksize = 141 cifs_sb->tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE; */ ··· 183 } 184 #endif 185 unload_nls(cifs_sb->local_nls); 186 + bdi_destroy(&cifs_sb->bdi); 187 kfree(cifs_sb); 188 } 189 return rc; ··· 214 #endif 215 216 unload_nls(cifs_sb->local_nls); 217 + bdi_destroy(&cifs_sb->bdi); 218 kfree(cifs_sb); 219 220 unlock_kernel();
+8
fs/coda/inode.c
··· 167 return -EBUSY; 168 } 169 170 vc->vc_sb = sb; 171 172 sb->s_fs_info = vc; ··· 179 sb->s_blocksize_bits = 12; 180 sb->s_magic = CODA_SUPER_MAGIC; 181 sb->s_op = &coda_super_operations; 182 183 /* get root fid from Venus: this needs the root inode */ 184 error = venus_rootfid(sb, &fid); ··· 205 return 0; 206 207 error: 208 if (root) 209 iput(root); 210 if (vc) ··· 217 218 static void coda_put_super(struct super_block *sb) 219 { 220 coda_vcp(sb)->vc_sb = NULL; 221 sb->s_fs_info = NULL; 222
··· 167 return -EBUSY; 168 } 169 170 + error = bdi_setup_and_register(&vc->bdi, "coda", BDI_CAP_MAP_COPY); 171 + if (error) 172 + goto bdi_err; 173 + 174 vc->vc_sb = sb; 175 176 sb->s_fs_info = vc; ··· 175 sb->s_blocksize_bits = 12; 176 sb->s_magic = CODA_SUPER_MAGIC; 177 sb->s_op = &coda_super_operations; 178 + sb->s_bdi = &vc->bdi; 179 180 /* get root fid from Venus: this needs the root inode */ 181 error = venus_rootfid(sb, &fid); ··· 200 return 0; 201 202 error: 203 + bdi_destroy(&vc->bdi); 204 + bdi_err: 205 if (root) 206 iput(root); 207 if (vc) ··· 210 211 static void coda_put_super(struct super_block *sb) 212 { 213 + bdi_destroy(&coda_vcp(sb)->bdi); 214 coda_vcp(sb)->vc_sb = NULL; 215 sb->s_fs_info = NULL; 216
+2
fs/ecryptfs/ecryptfs_kernel.h
··· 35 #include <linux/scatterlist.h> 36 #include <linux/hash.h> 37 #include <linux/nsproxy.h> 38 39 /* Version verification for shared data structures w/ userspace */ 40 #define ECRYPTFS_VERSION_MAJOR 0x00 ··· 394 struct ecryptfs_sb_info { 395 struct super_block *wsi_sb; 396 struct ecryptfs_mount_crypt_stat mount_crypt_stat; 397 }; 398 399 /* file private data. */
··· 35 #include <linux/scatterlist.h> 36 #include <linux/hash.h> 37 #include <linux/nsproxy.h> 38 + #include <linux/backing-dev.h> 39 40 /* Version verification for shared data structures w/ userspace */ 41 #define ECRYPTFS_VERSION_MAJOR 0x00 ··· 393 struct ecryptfs_sb_info { 394 struct super_block *wsi_sb; 395 struct ecryptfs_mount_crypt_stat mount_crypt_stat; 396 + struct backing_dev_info bdi; 397 }; 398 399 /* file private data. */
+9 -1
fs/ecryptfs/main.c
··· 497 static int 498 ecryptfs_fill_super(struct super_block *sb, void *raw_data, int silent) 499 { 500 int rc = 0; 501 502 /* Released in ecryptfs_put_super() */ 503 ecryptfs_set_superblock_private(sb, 504 kmem_cache_zalloc(ecryptfs_sb_info_cache, 505 GFP_KERNEL)); 506 - if (!ecryptfs_superblock_to_private(sb)) { 507 ecryptfs_printk(KERN_WARNING, "Out of memory\n"); 508 rc = -ENOMEM; 509 goto out; 510 } 511 sb->s_op = &ecryptfs_sops; 512 /* Released through deactivate_super(sb) from get_sb_nodev */ 513 sb->s_root = d_alloc(NULL, &(const struct qstr) {
··· 497 static int 498 ecryptfs_fill_super(struct super_block *sb, void *raw_data, int silent) 499 { 500 + struct ecryptfs_sb_info *esi; 501 int rc = 0; 502 503 /* Released in ecryptfs_put_super() */ 504 ecryptfs_set_superblock_private(sb, 505 kmem_cache_zalloc(ecryptfs_sb_info_cache, 506 GFP_KERNEL)); 507 + esi = ecryptfs_superblock_to_private(sb); 508 + if (!esi) { 509 ecryptfs_printk(KERN_WARNING, "Out of memory\n"); 510 rc = -ENOMEM; 511 goto out; 512 } 513 + 514 + rc = bdi_setup_and_register(&esi->bdi, "ecryptfs", BDI_CAP_MAP_COPY); 515 + if (rc) 516 + goto out; 517 + 518 + sb->s_bdi = &esi->bdi; 519 sb->s_op = &ecryptfs_sops; 520 /* Released through deactivate_super(sb) from get_sb_nodev */ 521 sb->s_root = d_alloc(NULL, &(const struct qstr) {
+1
fs/ecryptfs/super.c
··· 122 lock_kernel(); 123 124 ecryptfs_destroy_mount_crypt_stat(&sb_info->mount_crypt_stat); 125 kmem_cache_free(ecryptfs_sb_info_cache, sb_info); 126 ecryptfs_set_superblock_private(sb, NULL); 127
··· 122 lock_kernel(); 123 124 ecryptfs_destroy_mount_crypt_stat(&sb_info->mount_crypt_stat); 125 + bdi_destroy(&sb_info->bdi); 126 kmem_cache_free(ecryptfs_sb_info_cache, sb_info); 127 ecryptfs_set_superblock_private(sb, NULL); 128
+2
fs/exofs/exofs.h
··· 35 36 #include <linux/fs.h> 37 #include <linux/time.h> 38 #include "common.h" 39 40 /* FIXME: Remove once pnfs hits mainline ··· 93 struct exofs_layout layout; /* Default files layout, 94 * contains the variable osd_dev 95 * array. Keep last */ 96 struct osd_dev *_min_one_dev[1]; /* Place holder for one dev */ 97 }; 98
··· 35 36 #include <linux/fs.h> 37 #include <linux/time.h> 38 + #include <linux/backing-dev.h> 39 #include "common.h" 40 41 /* FIXME: Remove once pnfs hits mainline ··· 92 struct exofs_layout layout; /* Default files layout, 93 * contains the variable osd_dev 94 * array. Keep last */ 95 + struct backing_dev_info bdi; 96 struct osd_dev *_min_one_dev[1]; /* Place holder for one dev */ 97 }; 98
+8
fs/exofs/super.c
··· 302 _exofs_print_device("Unmounting", NULL, sbi->layout.s_ods[0], 303 sbi->layout.s_pid); 304 305 exofs_free_sbi(sbi); 306 sb->s_fs_info = NULL; 307 } ··· 547 if (!sbi) 548 return -ENOMEM; 549 550 /* use mount options to fill superblock */ 551 od = osduld_path_lookup(opts->dev_name); 552 if (IS_ERR(od)) { ··· 617 } 618 619 /* set up operation vectors */ 620 sb->s_fs_info = sbi; 621 sb->s_op = &exofs_sops; 622 sb->s_export_op = &exofs_export_ops; ··· 649 return 0; 650 651 free_sbi: 652 EXOFS_ERR("Unable to mount exofs on %s pid=0x%llx err=%d\n", 653 opts->dev_name, sbi->layout.s_pid, ret); 654 exofs_free_sbi(sbi);
··· 302 _exofs_print_device("Unmounting", NULL, sbi->layout.s_ods[0], 303 sbi->layout.s_pid); 304 305 + bdi_destroy(&sbi->bdi); 306 exofs_free_sbi(sbi); 307 sb->s_fs_info = NULL; 308 } ··· 546 if (!sbi) 547 return -ENOMEM; 548 549 + ret = bdi_setup_and_register(&sbi->bdi, "exofs", BDI_CAP_MAP_COPY); 550 + if (ret) 551 + goto free_bdi; 552 + 553 /* use mount options to fill superblock */ 554 od = osduld_path_lookup(opts->dev_name); 555 if (IS_ERR(od)) { ··· 612 } 613 614 /* set up operation vectors */ 615 + sb->s_bdi = &sbi->bdi; 616 sb->s_fs_info = sbi; 617 sb->s_op = &exofs_sops; 618 sb->s_export_op = &exofs_export_ops; ··· 643 return 0; 644 645 free_sbi: 646 + bdi_destroy(&sbi->bdi); 647 + free_bdi: 648 EXOFS_ERR("Unable to mount exofs on %s pid=0x%llx err=%d\n", 649 opts->dev_name, sbi->layout.s_pid, ret); 650 exofs_free_sbi(sbi);
+8
fs/ncpfs/inode.c
··· 526 sb->s_blocksize_bits = 10; 527 sb->s_magic = NCP_SUPER_MAGIC; 528 sb->s_op = &ncp_sops; 529 530 server = NCP_SBP(sb); 531 memset(server, 0, sizeof(*server)); 532 533 server->ncp_filp = ncp_filp; 534 server->ncp_sock = sock; ··· 724 if (server->info_filp) 725 fput(server->info_filp); 726 out_fput: 727 /* 23/12/1998 Marcin Dalecki <dalecki@cs.net.pl>: 728 * 729 * The previously used put_filp(ncp_filp); was bogous, since ··· 763 kill_pid(server->m.wdog_pid, SIGTERM, 1); 764 put_pid(server->m.wdog_pid); 765 766 kfree(server->priv.data); 767 kfree(server->auth.object_name); 768 vfree(server->rxbuf);
··· 526 sb->s_blocksize_bits = 10; 527 sb->s_magic = NCP_SUPER_MAGIC; 528 sb->s_op = &ncp_sops; 529 + sb->s_bdi = &server->bdi; 530 531 server = NCP_SBP(sb); 532 memset(server, 0, sizeof(*server)); 533 + 534 + error = bdi_setup_and_register(&server->bdi, "ncpfs", BDI_CAP_MAP_COPY); 535 + if (error) 536 + goto out_bdi; 537 538 server->ncp_filp = ncp_filp; 539 server->ncp_sock = sock; ··· 719 if (server->info_filp) 720 fput(server->info_filp); 721 out_fput: 722 + bdi_destroy(&server->bdi); 723 + out_bdi: 724 /* 23/12/1998 Marcin Dalecki <dalecki@cs.net.pl>: 725 * 726 * The previously used put_filp(ncp_filp); was bogous, since ··· 756 kill_pid(server->m.wdog_pid, SIGTERM, 1); 757 put_pid(server->m.wdog_pid); 758 759 + bdi_destroy(&server->bdi); 760 kfree(server->priv.data); 761 kfree(server->auth.object_name); 762 vfree(server->rxbuf);
+8
fs/smbfs/inode.c
··· 479 if (server->conn_pid) 480 kill_pid(server->conn_pid, SIGTERM, 1); 481 482 kfree(server->ops); 483 smb_unload_nls(server); 484 sb->s_fs_info = NULL; ··· 526 if (!server) 527 goto out_no_server; 528 sb->s_fs_info = server; 529 530 server->super_block = sb; 531 server->mnt = NULL; ··· 630 out_bad_option: 631 kfree(mem); 632 out_no_mem: 633 if (!server->mnt) 634 printk(KERN_ERR "smb_fill_super: allocation failure\n"); 635 sb->s_fs_info = NULL;
··· 479 if (server->conn_pid) 480 kill_pid(server->conn_pid, SIGTERM, 1); 481 482 + bdi_destroy(&server->bdi); 483 kfree(server->ops); 484 smb_unload_nls(server); 485 sb->s_fs_info = NULL; ··· 525 if (!server) 526 goto out_no_server; 527 sb->s_fs_info = server; 528 + 529 + if (bdi_setup_and_register(&server->bdi, "smbfs", BDI_CAP_MAP_COPY)) 530 + goto out_bdi; 531 + 532 + sb->s_bdi = &server->bdi; 533 534 server->super_block = sb; 535 server->mnt = NULL; ··· 624 out_bad_option: 625 kfree(mem); 626 out_no_mem: 627 + bdi_destroy(&server->bdi); 628 + out_bdi: 629 if (!server->mnt) 630 printk(KERN_ERR "smb_fill_super: allocation failure\n"); 631 sb->s_fs_info = NULL;
+5 -3
fs/super.c
··· 693 return -EMFILE; 694 } 695 s->s_dev = MKDEV(0, dev & MINORMASK); 696 return 0; 697 } 698 ··· 955 if (error < 0) 956 goto out_free_secdata; 957 BUG_ON(!mnt->mnt_sb); 958 959 - error = security_sb_kern_mount(mnt->mnt_sb, flags, secdata); 960 - if (error) 961 - goto out_sb; 962 963 /* 964 * filesystems should never set s_maxbytes larger than MAX_LFS_FILESIZE
··· 693 return -EMFILE; 694 } 695 s->s_dev = MKDEV(0, dev & MINORMASK); 696 + s->s_bdi = &noop_backing_dev_info; 697 return 0; 698 } 699 ··· 954 if (error < 0) 955 goto out_free_secdata; 956 BUG_ON(!mnt->mnt_sb); 957 + WARN_ON(!mnt->mnt_sb->s_bdi); 958 959 + error = security_sb_kern_mount(mnt->mnt_sb, flags, secdata); 960 + if (error) 961 + goto out_sb; 962 963 /* 964 * filesystems should never set s_maxbytes larger than MAX_LFS_FILESIZE
+2 -1
fs/sync.c
··· 14 #include <linux/pagemap.h> 15 #include <linux/quotaops.h> 16 #include <linux/buffer_head.h> 17 #include "internal.h" 18 19 #define VALID_FLAGS (SYNC_FILE_RANGE_WAIT_BEFORE|SYNC_FILE_RANGE_WRITE| \ ··· 33 * This should be safe, as we require bdi backing to actually 34 * write out data in the first place 35 */ 36 - if (!sb->s_bdi) 37 return 0; 38 39 if (sb->s_qcop && sb->s_qcop->quota_sync)
··· 14 #include <linux/pagemap.h> 15 #include <linux/quotaops.h> 16 #include <linux/buffer_head.h> 17 + #include <linux/backing-dev.h> 18 #include "internal.h" 19 20 #define VALID_FLAGS (SYNC_FILE_RANGE_WAIT_BEFORE|SYNC_FILE_RANGE_WRITE| \ ··· 32 * This should be safe, as we require bdi backing to actually 33 * write out data in the first place 34 */ 35 + if (!sb->s_bdi || sb->s_bdi == &noop_backing_dev_info) 36 return 0; 37 38 if (sb->s_qcop && sb->s_qcop->quota_sync)
+2
include/linux/backing-dev.h
··· 101 const char *fmt, ...); 102 int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev); 103 void bdi_unregister(struct backing_dev_info *bdi); 104 void bdi_start_writeback(struct backing_dev_info *bdi, struct super_block *sb, 105 long nr_pages); 106 int bdi_writeback_task(struct bdi_writeback *wb); ··· 247 #endif 248 249 extern struct backing_dev_info default_backing_dev_info; 250 void default_unplug_io_fn(struct backing_dev_info *bdi, struct page *page); 251 252 int writeback_in_progress(struct backing_dev_info *bdi);
··· 101 const char *fmt, ...); 102 int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev); 103 void bdi_unregister(struct backing_dev_info *bdi); 104 + int bdi_setup_and_register(struct backing_dev_info *, char *, unsigned int); 105 void bdi_start_writeback(struct backing_dev_info *bdi, struct super_block *sb, 106 long nr_pages); 107 int bdi_writeback_task(struct bdi_writeback *wb); ··· 246 #endif 247 248 extern struct backing_dev_info default_backing_dev_info; 249 + extern struct backing_dev_info noop_backing_dev_info; 250 void default_unplug_io_fn(struct backing_dev_info *bdi, struct page *page); 251 252 int writeback_in_progress(struct backing_dev_info *bdi);
+3
include/linux/coda_psdev.h
··· 7 #define MAX_CODADEVS 5 /* how many do we allow */ 8 9 #ifdef __KERNEL__ 10 struct kstatfs; 11 12 /* communication pending/processing queues */ ··· 19 struct list_head vc_processing; 20 int vc_inuse; 21 struct super_block *vc_sb; 22 }; 23 24
··· 7 #define MAX_CODADEVS 5 /* how many do we allow */ 8 9 #ifdef __KERNEL__ 10 + #include <linux/backing-dev.h> 11 + 12 struct kstatfs; 13 14 /* communication pending/processing queues */ ··· 17 struct list_head vc_processing; 18 int vc_inuse; 19 struct super_block *vc_sb; 20 + struct backing_dev_info bdi; 21 }; 22 23
+2
include/linux/ncp_fs_sb.h
··· 12 #include <linux/ncp_mount.h> 13 #include <linux/net.h> 14 #include <linux/mutex.h> 15 16 #ifdef __KERNEL__ 17 ··· 128 size_t len; 129 __u8 data[128]; 130 } unexpected_packet; 131 }; 132 133 extern void ncp_tcp_rcv_proc(struct work_struct *work);
··· 12 #include <linux/ncp_mount.h> 13 #include <linux/net.h> 14 #include <linux/mutex.h> 15 + #include <linux/backing-dev.h> 16 17 #ifdef __KERNEL__ 18 ··· 127 size_t len; 128 __u8 data[128]; 129 } unexpected_packet; 130 + struct backing_dev_info bdi; 131 }; 132 133 extern void ncp_tcp_rcv_proc(struct work_struct *work);
+3
include/linux/smb_fs_sb.h
··· 10 #define _SMB_FS_SB 11 12 #include <linux/types.h> 13 #include <linux/smb.h> 14 15 /* ··· 75 struct smb_ops *ops; 76 77 struct super_block *super_block; 78 }; 79 80 static inline int
··· 10 #define _SMB_FS_SB 11 12 #include <linux/types.h> 13 + #include <linux/backing-dev.h> 14 #include <linux/smb.h> 15 16 /* ··· 74 struct smb_ops *ops; 75 76 struct super_block *super_block; 77 + 78 + struct backing_dev_info bdi; 79 }; 80 81 static inline int
+34
mm/backing-dev.c
··· 11 #include <linux/writeback.h> 12 #include <linux/device.h> 13 14 void default_unplug_io_fn(struct backing_dev_info *bdi, struct page *page) 15 { 16 } ··· 26 .unplug_io_fn = default_unplug_io_fn, 27 }; 28 EXPORT_SYMBOL_GPL(default_backing_dev_info); 29 30 static struct class *bdi_class; 31 ··· 721 prop_local_destroy_percpu(&bdi->completions); 722 } 723 EXPORT_SYMBOL(bdi_destroy); 724 725 static wait_queue_head_t congestion_wqh[2] = { 726 __WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[0]),
··· 11 #include <linux/writeback.h> 12 #include <linux/device.h> 13 14 + static atomic_long_t bdi_seq = ATOMIC_LONG_INIT(0); 15 + 16 void default_unplug_io_fn(struct backing_dev_info *bdi, struct page *page) 17 { 18 } ··· 24 .unplug_io_fn = default_unplug_io_fn, 25 }; 26 EXPORT_SYMBOL_GPL(default_backing_dev_info); 27 + 28 + struct backing_dev_info noop_backing_dev_info = { 29 + .name = "noop", 30 + }; 31 + EXPORT_SYMBOL_GPL(noop_backing_dev_info); 32 33 static struct class *bdi_class; 34 ··· 714 prop_local_destroy_percpu(&bdi->completions); 715 } 716 EXPORT_SYMBOL(bdi_destroy); 717 + 718 + /* 719 + * For use from filesystems to quickly init and register a bdi associated 720 + * with dirty writeback 721 + */ 722 + int bdi_setup_and_register(struct backing_dev_info *bdi, char *name, 723 + unsigned int cap) 724 + { 725 + char tmp[32]; 726 + int err; 727 + 728 + bdi->name = name; 729 + bdi->capabilities = cap; 730 + err = bdi_init(bdi); 731 + if (err) 732 + return err; 733 + 734 + sprintf(tmp, "%.28s%s", name, "-%d"); 735 + err = bdi_register(bdi, NULL, tmp, atomic_long_inc_return(&bdi_seq)); 736 + if (err) { 737 + bdi_destroy(bdi); 738 + return err; 739 + } 740 + 741 + return 0; 742 + } 743 + EXPORT_SYMBOL(bdi_setup_and_register); 744 745 static wait_queue_head_t congestion_wqh[2] = { 746 __WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[0]),