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