Skip to content

Commit

Permalink
9p: add bdi backing to mount session
Browse files Browse the repository at this point in the history
This ensures that dirty data gets flushed properly.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
  • Loading branch information
Jens Axboe committed Apr 22, 2010
1 parent c3c5320 commit 0ed07dd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
10 changes: 10 additions & 0 deletions fs/9p/v9fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,13 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses,
return ERR_PTR(-ENOMEM);
}

rc = bdi_setup_and_register(&v9ses->bdi, "9p", BDI_CAP_MAP_COPY);
if (rc) {
__putname(v9ses->aname);
__putname(v9ses->uname);
return ERR_PTR(rc);
}

spin_lock(&v9fs_sessionlist_lock);
list_add(&v9ses->slist, &v9fs_sessionlist);
spin_unlock(&v9fs_sessionlist_lock);
Expand Down Expand Up @@ -301,6 +308,7 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses,
return fid;

error:
bdi_destroy(&v9ses->bdi);
return ERR_PTR(retval);
}

Expand All @@ -326,6 +334,8 @@ void v9fs_session_close(struct v9fs_session_info *v9ses)
__putname(v9ses->uname);
__putname(v9ses->aname);

bdi_destroy(&v9ses->bdi);

spin_lock(&v9fs_sessionlist_lock);
list_del(&v9ses->slist);
spin_unlock(&v9fs_sessionlist_lock);
Expand Down
2 changes: 2 additions & 0 deletions fs/9p/v9fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
* Boston, MA 02111-1301 USA
*
*/
#include <linux/backing-dev.h>

/**
* enum p9_session_flags - option flags for each 9P session
Expand Down Expand Up @@ -102,6 +103,7 @@ struct v9fs_session_info {
u32 uid; /* if ACCESS_SINGLE, the uid that has access */
struct p9_client *clnt; /* 9p client */
struct list_head slist; /* list of sessions registered with v9fs */
struct backing_dev_info bdi;
};

struct p9_fid *v9fs_session_init(struct v9fs_session_info *, const char *,
Expand Down
1 change: 1 addition & 0 deletions fs/9p/vfs_super.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ v9fs_fill_super(struct super_block *sb, struct v9fs_session_info *v9ses,
sb->s_blocksize = 1 << sb->s_blocksize_bits;
sb->s_magic = V9FS_MAGIC;
sb->s_op = &v9fs_super_ops;
sb->s_bdi = &v9ses->bdi;

sb->s_flags = flags | MS_ACTIVE | MS_SYNCHRONOUS | MS_DIRSYNC |
MS_NOATIME;
Expand Down

0 comments on commit 0ed07dd

Please sign in to comment.