ncpfs: Convert to separately allocated bdi
authorJan Kara <jack@suse.cz>
Wed, 12 Apr 2017 10:24:44 +0000 (12:24 +0200)
committerJens Axboe <axboe@fb.com>
Thu, 20 Apr 2017 18:09:55 +0000 (12:09 -0600)
Allocate struct backing_dev_info separately instead of embedding it
inside the superblock. This unifies handling of bdi among users.

CC: Petr Vandrovec <petr@vandrovec.name>
Acked-by: Petr Vandrovec <petr@vandrovec.name>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jens Axboe <axboe@fb.com>
fs/ncpfs/inode.c
fs/ncpfs/ncp_fs_sb.h

index d5606099712a4cb2059c4dac9036aba35e9c3751..6d0f14c8609971378ee75104380873a6da67a4be 100644 (file)
@@ -554,12 +554,11 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
        sb->s_magic = NCP_SUPER_MAGIC;
        sb->s_op = &ncp_sops;
        sb->s_d_op = &ncp_dentry_operations;
-       sb->s_bdi = &server->bdi;
 
        server = NCP_SBP(sb);
        memset(server, 0, sizeof(*server));
 
-       error = bdi_setup_and_register(&server->bdi, "ncpfs");
+       error = super_setup_bdi(sb);
        if (error)
                goto out_fput;
 
@@ -568,7 +567,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
        if (data.info_fd != -1) {
                struct socket *info_sock = sockfd_lookup(data.info_fd, &error);
                if (!info_sock)
-                       goto out_bdi;
+                       goto out_fput;
                server->info_sock = info_sock;
                error = -EBADFD;
                if (info_sock->type != SOCK_STREAM)
@@ -746,8 +745,6 @@ out_nls:
 out_fput2:
        if (server->info_sock)
                sockfd_put(server->info_sock);
-out_bdi:
-       bdi_destroy(&server->bdi);
 out_fput:
        sockfd_put(sock);
 out:
@@ -788,7 +785,6 @@ static void ncp_put_super(struct super_block *sb)
        kill_pid(server->m.wdog_pid, SIGTERM, 1);
        put_pid(server->m.wdog_pid);
 
-       bdi_destroy(&server->bdi);
        kfree(server->priv.data);
        kfree(server->auth.object_name);
        vfree(server->rxbuf);
index 55e26fd8088694308aeee3ceff1d11b91d6b1fb5..366fd63cc506fc3e61be93877349ef6032cf5734 100644 (file)
@@ -143,7 +143,6 @@ struct ncp_server {
                size_t len;
                __u8 data[128];
        } unexpected_packet;
-       struct backing_dev_info bdi;
 };
 
 extern void ncp_tcp_rcv_proc(struct work_struct *work);