diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-24 10:41:13 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-24 10:41:13 -0400 |
| commit | 4fd5ec509bd486b5dd8cac1a4d4d7e2cbdf7c546 (patch) | |
| tree | a8ddfdcc4bfb702457e8eeff57fd6b5a2f4249b2 | |
| parent | 6e188240ebc2a132d70924942d7c8b9acb46e11a (diff) | |
| parent | 6d27e64d74e14c1cf2b4af438d7e8a77017bd654 (diff) | |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs:
9p: Optimize TCREATE by eliminating a redundant fid clone.
9p: cleanup: remove unneeded assignment
9p: Add mksock support
fs/9p: Make sure we properly instantiate dentry.
9p: add 9P2000.L rename operation
9p: add 9P2000.L statfs operation
9p: VFS switches for 9p2000.L: VFS switches
9p: VFS switches for 9p2000.L: protocol and client changes
| -rw-r--r-- | fs/9p/v9fs_vfs.h | 2 | ||||
| -rw-r--r-- | fs/9p/vfs_dir.c | 8 | ||||
| -rw-r--r-- | fs/9p/vfs_file.c | 11 | ||||
| -rw-r--r-- | fs/9p/vfs_inode.c | 107 | ||||
| -rw-r--r-- | fs/9p/vfs_super.c | 55 | ||||
| -rw-r--r-- | include/net/9p/9p.h | 33 | ||||
| -rw-r--r-- | include/net/9p/client.h | 2 | ||||
| -rw-r--r-- | net/9p/client.c | 70 | ||||
| -rw-r--r-- | net/9p/protocol.c | 6 |
9 files changed, 261 insertions, 33 deletions
diff --git a/fs/9p/v9fs_vfs.h b/fs/9p/v9fs_vfs.h index ed835836e0dc..32ef4009d030 100644 --- a/fs/9p/v9fs_vfs.h +++ b/fs/9p/v9fs_vfs.h | |||
| @@ -40,7 +40,9 @@ | |||
| 40 | extern struct file_system_type v9fs_fs_type; | 40 | extern struct file_system_type v9fs_fs_type; |
| 41 | extern const struct address_space_operations v9fs_addr_operations; | 41 | extern const struct address_space_operations v9fs_addr_operations; |
| 42 | extern const struct file_operations v9fs_file_operations; | 42 | extern const struct file_operations v9fs_file_operations; |
| 43 | extern const struct file_operations v9fs_file_operations_dotl; | ||
| 43 | extern const struct file_operations v9fs_dir_operations; | 44 | extern const struct file_operations v9fs_dir_operations; |
| 45 | extern const struct file_operations v9fs_dir_operations_dotl; | ||
| 44 | extern const struct dentry_operations v9fs_dentry_operations; | 46 | extern const struct dentry_operations v9fs_dentry_operations; |
| 45 | extern const struct dentry_operations v9fs_cached_dentry_operations; | 47 | extern const struct dentry_operations v9fs_cached_dentry_operations; |
| 46 | 48 | ||
diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c index 0adfd64dfcee..d61e3b28ce37 100644 --- a/fs/9p/vfs_dir.c +++ b/fs/9p/vfs_dir.c | |||
| @@ -203,3 +203,11 @@ const struct file_operations v9fs_dir_operations = { | |||
| 203 | .open = v9fs_file_open, | 203 | .open = v9fs_file_open, |
| 204 | .release = v9fs_dir_release, | 204 | .release = v9fs_dir_release, |
| 205 | }; | 205 | }; |
| 206 | |||
| 207 | const struct file_operations v9fs_dir_operations_dotl = { | ||
| 208 | .read = generic_read_dir, | ||
| 209 | .llseek = generic_file_llseek, | ||
| 210 | .readdir = v9fs_dir_readdir, | ||
| 211 | .open = v9fs_file_open, | ||
| 212 | .release = v9fs_dir_release, | ||
| 213 | }; | ||
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index df52d488d2a6..25b300e1c9d7 100644 --- a/fs/9p/vfs_file.c +++ b/fs/9p/vfs_file.c | |||
| @@ -296,3 +296,14 @@ const struct file_operations v9fs_file_operations = { | |||
| 296 | .mmap = generic_file_readonly_mmap, | 296 | .mmap = generic_file_readonly_mmap, |
| 297 | .fsync = v9fs_file_fsync, | 297 | .fsync = v9fs_file_fsync, |
| 298 | }; | 298 | }; |
| 299 | |||
| 300 | const struct file_operations v9fs_file_operations_dotl = { | ||
| 301 | .llseek = generic_file_llseek, | ||
| 302 | .read = v9fs_file_read, | ||
| 303 | .write = v9fs_file_write, | ||
| 304 | .open = v9fs_file_open, | ||
| 305 | .release = v9fs_dir_release, | ||
| 306 | .lock = v9fs_file_lock, | ||
| 307 | .mmap = generic_file_readonly_mmap, | ||
| 308 | .fsync = v9fs_file_fsync, | ||
| 309 | }; | ||
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index 6d4d86187c55..4331b3b5ee1c 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c | |||
| @@ -44,9 +44,12 @@ | |||
| 44 | #include "cache.h" | 44 | #include "cache.h" |
| 45 | 45 | ||
| 46 | static const struct inode_operations v9fs_dir_inode_operations; | 46 | static const struct inode_operations v9fs_dir_inode_operations; |
| 47 | static const struct inode_operations v9fs_dir_inode_operations_ext; | 47 | static const struct inode_operations v9fs_dir_inode_operations_dotu; |
| 48 | static const struct inode_operations v9fs_dir_inode_operations_dotl; | ||
| 48 | static const struct inode_operations v9fs_file_inode_operations; | 49 | static const struct inode_operations v9fs_file_inode_operations; |
| 50 | static const struct inode_operations v9fs_file_inode_operations_dotl; | ||
| 49 | static const struct inode_operations v9fs_symlink_inode_operations; | 51 | static const struct inode_operations v9fs_symlink_inode_operations; |
| 52 | static const struct inode_operations v9fs_symlink_inode_operations_dotl; | ||
| 50 | 53 | ||
| 51 | /** | 54 | /** |
| 52 | * unixmode2p9mode - convert unix mode bits to plan 9 | 55 | * unixmode2p9mode - convert unix mode bits to plan 9 |
| @@ -273,25 +276,44 @@ struct inode *v9fs_get_inode(struct super_block *sb, int mode) | |||
| 273 | init_special_inode(inode, inode->i_mode, inode->i_rdev); | 276 | init_special_inode(inode, inode->i_mode, inode->i_rdev); |
| 274 | break; | 277 | break; |
| 275 | case S_IFREG: | 278 | case S_IFREG: |
| 276 | inode->i_op = &v9fs_file_inode_operations; | 279 | if (v9fs_proto_dotl(v9ses)) { |
| 277 | inode->i_fop = &v9fs_file_operations; | 280 | inode->i_op = &v9fs_file_inode_operations_dotl; |
| 281 | inode->i_fop = &v9fs_file_operations_dotl; | ||
| 282 | } else { | ||
| 283 | inode->i_op = &v9fs_file_inode_operations; | ||
| 284 | inode->i_fop = &v9fs_file_operations; | ||
| 285 | } | ||
| 286 | |||
| 278 | break; | 287 | break; |
| 288 | |||
| 279 | case S_IFLNK: | 289 | case S_IFLNK: |
| 280 | if (!v9fs_proto_dotu(v9ses)) { | 290 | if (!v9fs_proto_dotu(v9ses) && !v9fs_proto_dotl(v9ses)) { |
| 281 | P9_DPRINTK(P9_DEBUG_ERROR, | 291 | P9_DPRINTK(P9_DEBUG_ERROR, "extended modes used with " |
| 282 | "extended modes used w/o 9P2000.u\n"); | 292 | "legacy protocol.\n"); |
| 283 | err = -EINVAL; | 293 | err = -EINVAL; |
| 284 | goto error; | 294 | goto error; |
| 285 | } | 295 | } |
| 286 | inode->i_op = &v9fs_symlink_inode_operations; | 296 | |
| 297 | if (v9fs_proto_dotl(v9ses)) | ||
| 298 | inode->i_op = &v9fs_symlink_inode_operations_dotl; | ||
| 299 | else | ||
| 300 | inode->i_op = &v9fs_symlink_inode_operations; | ||
| 301 | |||
| 287 | break; | 302 | break; |
| 288 | case S_IFDIR: | 303 | case S_IFDIR: |
| 289 | inc_nlink(inode); | 304 | inc_nlink(inode); |
| 290 | if (v9fs_proto_dotu(v9ses)) | 305 | if (v9fs_proto_dotl(v9ses)) |
| 291 | inode->i_op = &v9fs_dir_inode_operations_ext; | 306 | inode->i_op = &v9fs_dir_inode_operations_dotl; |
| 307 | else if (v9fs_proto_dotu(v9ses)) | ||
| 308 | inode->i_op = &v9fs_dir_inode_operations_dotu; | ||
| 292 | else | 309 | else |
| 293 | inode->i_op = &v9fs_dir_inode_operations; | 310 | inode->i_op = &v9fs_dir_inode_operations; |
| 294 | inode->i_fop = &v9fs_dir_operations; | 311 | |
| 312 | if (v9fs_proto_dotl(v9ses)) | ||
| 313 | inode->i_fop = &v9fs_dir_operations_dotl; | ||
| 314 | else | ||
| 315 | inode->i_fop = &v9fs_dir_operations; | ||
| 316 | |||
| 295 | break; | 317 | break; |
| 296 | default: | 318 | default: |
| 297 | P9_DPRINTK(P9_DEBUG_ERROR, "BAD mode 0x%x S_IFMT 0x%x\n", | 319 | P9_DPRINTK(P9_DEBUG_ERROR, "BAD mode 0x%x S_IFMT 0x%x\n", |
| @@ -432,14 +454,12 @@ static int v9fs_remove(struct inode *dir, struct dentry *file, int rmdir) | |||
| 432 | { | 454 | { |
| 433 | int retval; | 455 | int retval; |
| 434 | struct inode *file_inode; | 456 | struct inode *file_inode; |
| 435 | struct v9fs_session_info *v9ses; | ||
| 436 | struct p9_fid *v9fid; | 457 | struct p9_fid *v9fid; |
| 437 | 458 | ||
| 438 | P9_DPRINTK(P9_DEBUG_VFS, "inode: %p dentry: %p rmdir: %d\n", dir, file, | 459 | P9_DPRINTK(P9_DEBUG_VFS, "inode: %p dentry: %p rmdir: %d\n", dir, file, |
| 439 | rmdir); | 460 | rmdir); |
| 440 | 461 | ||
| 441 | file_inode = file->d_inode; | 462 | file_inode = file->d_inode; |
| 442 | v9ses = v9fs_inode2v9ses(file_inode); | ||
| 443 | v9fid = v9fs_fid_clone(file); | 463 | v9fid = v9fs_fid_clone(file); |
| 444 | if (IS_ERR(v9fid)) | 464 | if (IS_ERR(v9fid)) |
| 445 | return PTR_ERR(v9fid); | 465 | return PTR_ERR(v9fid); |
| @@ -482,12 +502,11 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir, | |||
| 482 | ofid = NULL; | 502 | ofid = NULL; |
| 483 | fid = NULL; | 503 | fid = NULL; |
| 484 | name = (char *) dentry->d_name.name; | 504 | name = (char *) dentry->d_name.name; |
| 485 | dfid = v9fs_fid_clone(dentry->d_parent); | 505 | dfid = v9fs_fid_lookup(dentry->d_parent); |
| 486 | if (IS_ERR(dfid)) { | 506 | if (IS_ERR(dfid)) { |
| 487 | err = PTR_ERR(dfid); | 507 | err = PTR_ERR(dfid); |
| 488 | P9_DPRINTK(P9_DEBUG_VFS, "fid clone failed %d\n", err); | 508 | P9_DPRINTK(P9_DEBUG_VFS, "fid lookup failed %d\n", err); |
| 489 | dfid = NULL; | 509 | return ERR_PTR(err); |
| 490 | goto error; | ||
| 491 | } | 510 | } |
| 492 | 511 | ||
| 493 | /* clone a fid to use for creation */ | 512 | /* clone a fid to use for creation */ |
| @@ -495,8 +514,7 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir, | |||
| 495 | if (IS_ERR(ofid)) { | 514 | if (IS_ERR(ofid)) { |
| 496 | err = PTR_ERR(ofid); | 515 | err = PTR_ERR(ofid); |
| 497 | P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err); | 516 | P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err); |
| 498 | ofid = NULL; | 517 | return ERR_PTR(err); |
| 499 | goto error; | ||
| 500 | } | 518 | } |
| 501 | 519 | ||
| 502 | err = p9_client_fcreate(ofid, name, perm, mode, extension); | 520 | err = p9_client_fcreate(ofid, name, perm, mode, extension); |
| @@ -506,14 +524,13 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir, | |||
| 506 | } | 524 | } |
| 507 | 525 | ||
| 508 | /* now walk from the parent so we can get unopened fid */ | 526 | /* now walk from the parent so we can get unopened fid */ |
| 509 | fid = p9_client_walk(dfid, 1, &name, 0); | 527 | fid = p9_client_walk(dfid, 1, &name, 1 |
