Commit 0ed07ddb authored by Jens Axboe's avatar Jens Axboe

9p: add bdi backing to mount session

This ensures that dirty data gets flushed properly.
Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
parent c3c53206
...@@ -238,6 +238,13 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses, ...@@ -238,6 +238,13 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses,
return ERR_PTR(-ENOMEM); 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); spin_lock(&v9fs_sessionlist_lock);
list_add(&v9ses->slist, &v9fs_sessionlist); list_add(&v9ses->slist, &v9fs_sessionlist);
spin_unlock(&v9fs_sessionlist_lock); spin_unlock(&v9fs_sessionlist_lock);
...@@ -301,6 +308,7 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses, ...@@ -301,6 +308,7 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses,
return fid; return fid;
error: error:
bdi_destroy(&v9ses->bdi);
return ERR_PTR(retval); return ERR_PTR(retval);
} }
...@@ -326,6 +334,8 @@ void v9fs_session_close(struct v9fs_session_info *v9ses) ...@@ -326,6 +334,8 @@ void v9fs_session_close(struct v9fs_session_info *v9ses)
__putname(v9ses->uname); __putname(v9ses->uname);
__putname(v9ses->aname); __putname(v9ses->aname);
bdi_destroy(&v9ses->bdi);
spin_lock(&v9fs_sessionlist_lock); spin_lock(&v9fs_sessionlist_lock);
list_del(&v9ses->slist); list_del(&v9ses->slist);
spin_unlock(&v9fs_sessionlist_lock); spin_unlock(&v9fs_sessionlist_lock);
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
* Boston, MA 02111-1301 USA * Boston, MA 02111-1301 USA
* *
*/ */
#include <linux/backing-dev.h>
/** /**
* enum p9_session_flags - option flags for each 9P session * enum p9_session_flags - option flags for each 9P session
...@@ -102,6 +103,7 @@ struct v9fs_session_info { ...@@ -102,6 +103,7 @@ struct v9fs_session_info {
u32 uid; /* if ACCESS_SINGLE, the uid that has access */ u32 uid; /* if ACCESS_SINGLE, the uid that has access */
struct p9_client *clnt; /* 9p client */ struct p9_client *clnt; /* 9p client */
struct list_head slist; /* list of sessions registered with v9fs */ 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 *, struct p9_fid *v9fs_session_init(struct v9fs_session_info *, const char *,
......
...@@ -77,6 +77,7 @@ v9fs_fill_super(struct super_block *sb, struct v9fs_session_info *v9ses, ...@@ -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_blocksize = 1 << sb->s_blocksize_bits;
sb->s_magic = V9FS_MAGIC; sb->s_magic = V9FS_MAGIC;
sb->s_op = &v9fs_super_ops; sb->s_op = &v9fs_super_ops;
sb->s_bdi = &v9ses->bdi;
sb->s_flags = flags | MS_ACTIVE | MS_SYNCHRONOUS | MS_DIRSYNC | sb->s_flags = flags | MS_ACTIVE | MS_SYNCHRONOUS | MS_DIRSYNC |
MS_NOATIME; MS_NOATIME;
......
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