Commit fa799759 authored by Miklos Szeredi's avatar Miklos Szeredi Committed by Linus Torvalds

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: default avatarMiklos 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: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent cf0ca9fe
...@@ -1575,6 +1575,11 @@ static int nfs_compare_super(struct super_block *sb, void *data) ...@@ -1575,6 +1575,11 @@ static int nfs_compare_super(struct super_block *sb, void *data)
return nfs_compare_mount_options(sb, server, mntflags); return nfs_compare_mount_options(sb, server, mntflags);
} }
static int nfs_bdi_register(struct nfs_server *server)
{
return bdi_register_dev(&server->backing_dev_info, server->s_dev);
}
static int nfs_get_sb(struct file_system_type *fs_type, static int nfs_get_sb(struct file_system_type *fs_type,
int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt) int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt)
{ {
...@@ -1617,6 +1622,10 @@ static int nfs_get_sb(struct file_system_type *fs_type, ...@@ -1617,6 +1622,10 @@ static int nfs_get_sb(struct file_system_type *fs_type,
if (s->s_fs_info != server) { if (s->s_fs_info != server) {
nfs_free_server(server); nfs_free_server(server);
server = NULL; server = NULL;
} else {
error = nfs_bdi_register(server);
if (error)
goto error_splat_super;
} }
if (!s->s_root) { if (!s->s_root) {
...@@ -1664,6 +1673,7 @@ static void nfs_kill_super(struct super_block *s) ...@@ -1664,6 +1673,7 @@ static void nfs_kill_super(struct super_block *s)
{ {
struct nfs_server *server = NFS_SB(s); struct nfs_server *server = NFS_SB(s);
bdi_unregister(&server->backing_dev_info);
kill_anon_super(s); kill_anon_super(s);
nfs_free_server(server); nfs_free_server(server);
} }
...@@ -1708,6 +1718,10 @@ static int nfs_xdev_get_sb(struct file_system_type *fs_type, int flags, ...@@ -1708,6 +1718,10 @@ static int nfs_xdev_get_sb(struct file_system_type *fs_type, int flags,
if (s->s_fs_info != server) { if (s->s_fs_info != server) {
nfs_free_server(server); nfs_free_server(server);
server = NULL; server = NULL;
} else {
error = nfs_bdi_register(server);
if (error)
goto error_splat_super;
} }
if (!s->s_root) { if (!s->s_root) {
...@@ -1984,6 +1998,10 @@ static int nfs4_get_sb(struct file_system_type *fs_type, ...@@ -1984,6 +1998,10 @@ static int nfs4_get_sb(struct file_system_type *fs_type,
if (s->s_fs_info != server) { if (s->s_fs_info != server) {
nfs_free_server(server); nfs_free_server(server);
server = NULL; server = NULL;
} else {
error = nfs_bdi_register(server);
if (error)
goto error_splat_super;
} }
if (!s->s_root) { if (!s->s_root) {
...@@ -2070,6 +2088,10 @@ static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags, ...@@ -2070,6 +2088,10 @@ static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags,
if (s->s_fs_info != server) { if (s->s_fs_info != server) {
nfs_free_server(server); nfs_free_server(server);
server = NULL; server = NULL;
} else {
error = nfs_bdi_register(server);
if (error)
goto error_splat_super;
} }
if (!s->s_root) { if (!s->s_root) {
...@@ -2149,6 +2171,10 @@ static int nfs4_referral_get_sb(struct file_system_type *fs_type, int flags, ...@@ -2149,6 +2171,10 @@ static int nfs4_referral_get_sb(struct file_system_type *fs_type, int flags,
if (s->s_fs_info != server) { if (s->s_fs_info != server) {
nfs_free_server(server); nfs_free_server(server);
server = NULL; server = NULL;
} else {
error = nfs_bdi_register(server);
if (error)
goto error_splat_super;
} }
if (!s->s_root) { if (!s->s_root) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment