aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2008-04-30 03:54:33 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-30 11:29:49 -0400
commitfa799759f9801137f665dbedda2c0815f1bf6f1b (patch)
treec921e2bcda0e2aa094aec1c3bbf4f89b319d4855
parentcf0ca9fe5dd9e3693d935757a7b2fc50fc576554 (diff)
mm: bdi: expose the BDI object in sysfs for NFS
Register NFS' backing_dev_info under sysfs with the name "nfs-MAJOR:MINOR" Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Trond Myklebust <trond.myklebust@fys.uio.no> Cc: "J. Bruce Fields" <bfields@fieldses.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--fs/nfs/super.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index fa220dc74609..7226a506f3ca 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -1575,6 +1575,11 @@ static int nfs_compare_super(struct super_block *sb, void *data)
1575 return nfs_compare_mount_options(sb, server, mntflags); 1575 return nfs_compare_mount_options(sb, server, mntflags);
1576} 1576}
1577 1577
1578static int nfs_bdi_register(struct nfs_server *server)
1579{
1580 return bdi_register_dev(&server->backing_dev_info, server->s_dev);
1581}
1582
1578static int nfs_get_sb(struct file_system_type *fs_type, 1583static int nfs_get_sb(struct file_system_type *fs_type,
1579 int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt) 1584 int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt)
1580{ 1585{
@@ -1617,6 +1622,10 @@ static int nfs_get_sb(struct file_system_type *fs_type,
1617 if (s->s_fs_info != server) { 1622 if (s->s_fs_info != server) {
1618 nfs_free_server(server); 1623 nfs_free_server(server);
1619 server = NULL; 1624 server = NULL;
1625 } else {
1626 error = nfs_bdi_register(server);
1627 if (error)
1628 goto error_splat_super;
1620 } 1629 }
1621 1630
1622 if (!s->s_root) { 1631 if (!s->s_root) {
@@ -1664,6 +1673,7 @@ static void nfs_kill_super(struct super_block *s)
1664{ 1673{
1665 struct nfs_server *server = NFS_SB(s); 1674 struct nfs_server *server = NFS_SB(s);
1666 1675
1676 bdi_unregister(&server->backing_dev_info);
1667 kill_anon_super(s); 1677 kill_anon_super(s);
1668 nfs_free_server(server); 1678 nfs_free_server(server);
1669} 1679}
@@ -1708,6 +1718,10 @@ static int nfs_xdev_get_sb(struct file_system_type *fs_type, int flags,
1708 if (s->s_fs_info != server) { 1718 if (s->s_fs_info != server) {
1709 nfs_free_server(server); 1719 nfs_free_server(server);
1710 server = NULL; 1720 server = NULL;
1721 } else {
1722 error = nfs_bdi_register(server);
1723 if (error)
1724 goto error_splat_super;
1711 } 1725 }
1712 1726
1713 if (!s->s_root) { 1727 if (!s->s_root) {
@@ -1984,6 +1998,10 @@ static int nfs4_get_sb(struct file_system_type *fs_type,
1984 if (s->s_fs_info != server) { 1998 if (s->s_fs_info != server) {
1985 nfs_free_server(server); 1999 nfs_free_server(server);
1986 server = NULL; 2000 server = NULL;
2001 } else {
2002 error = nfs_bdi_register(server);
2003 if (error)
2004 goto error_splat_super;
1987 } 2005 }
1988 2006
1989 if (!s->s_root) { 2007 if (!s->s_root) {
@@ -2070,6 +2088,10 @@ static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags,
2070 if (s->s_fs_info != server) { 2088 if (s->s_fs_info != server) {
2071 nfs_free_server(server); 2089 nfs_free_server(server);
2072 server = NULL; 2090 server = NULL;
2091 } else {
2092 error = nfs_bdi_register(server);
2093 if (error)
2094 goto error_splat_super;
2073 } 2095 }
2074 2096
2075 if (!s->s_root) { 2097 if (!s->s_root) {
@@ -2149,6 +2171,10 @@ static int nfs4_referral_get_sb(struct file_system_type *fs_type, int flags,
2149 if (s->s_fs_info != server) { 2171 if (s->s_fs_info != server) {
2150 nfs_free_server(server); 2172 nfs_free_server(server);
2151 server = NULL; 2173 server = NULL;
2174 } else {
2175 error = nfs_bdi_register(server);
2176 if (error)
2177 goto error_splat_super;
2152 } 2178 }
2153 2179
2154 if (!s->s_root) { 2180 if (!s->s_root) {