diff options
author | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2011-02-28 06:33:57 -0500 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@gmail.com> | 2011-03-15 10:57:37 -0400 |
commit | 3cf387d780944305839f5b27c51f225444ba4d27 (patch) | |
tree | ed4ef1d723ed3c7c280aadfcf397218004e49252 /fs/9p/fid.c | |
parent | 17311779ac3dcd06f8ef727a06969c439e116a20 (diff) |
fs/9p: Add fid to inode in cached mode
The fid attached to inode will be opened O_RDWR mode and is used
for dirty page writeback only.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'fs/9p/fid.c')
-rw-r--r-- | fs/9p/fid.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/fs/9p/fid.c b/fs/9p/fid.c index b00223c99d70..9d6a5d3bfe15 100644 --- a/fs/9p/fid.c +++ b/fs/9p/fid.c | |||
@@ -261,3 +261,29 @@ struct p9_fid *v9fs_fid_clone(struct dentry *dentry) | |||
261 | ret = p9_client_walk(fid, 0, NULL, 1); | 261 | ret = p9_client_walk(fid, 0, NULL, 1); |
262 | return ret; | 262 | return ret; |
263 | } | 263 | } |
264 | |||
265 | |||
266 | struct p9_fid *v9fs_writeback_fid(struct dentry *dentry) | ||
267 | { | ||
268 | int err; | ||
269 | struct p9_fid *fid; | ||
270 | |||
271 | fid = v9fs_fid_clone(dentry); | ||
272 | if (IS_ERR(fid)) | ||
273 | goto error_out; | ||
274 | /* | ||
275 | * writeback fid will only be used to write back the | ||
276 | * dirty pages. We always request for the open fid in read-write | ||
277 | * mode so that a partial page write which result in page | ||
278 | * read can work. | ||
279 | * FIXME!!: we should make the fid owned by uid = 0 | ||
280 | */ | ||
281 | err = p9_client_open(fid, O_RDWR); | ||
282 | if (err < 0) { | ||
283 | p9_client_clunk(fid); | ||
284 | fid = ERR_PTR(err); | ||
285 | goto error_out; | ||
286 | } | ||
287 | error_out: | ||
288 | return fid; | ||
289 | } | ||