From 57637e704f7503c8212faa468162e00f861e8a07 Mon Sep 17 00:00:00 2001 From: Guenter Roeck Date: Sun, 28 Aug 2011 13:01:49 -0700 Subject: [PATCH] --- yaml --- r: 263637 b: refs/heads/master c: ff71c182f461da5ae9d2d65f8a63f5a9193b9be1 h: refs/heads/master i: 263635: 941f738749e34d69fddbd8aa7c111c20c7698252 v: v3 --- [refs] | 2 +- trunk/arch/x86/include/asm/pvclock.h | 2 +- trunk/arch/x86/xen/setup.c | 19 ---- trunk/arch/x86/xen/smp.c | 10 -- trunk/arch/x86/xen/xen-asm_32.S | 8 +- trunk/drivers/hwmon/max16065.c | 2 +- trunk/fs/9p/v9fs_vfs.h | 6 +- trunk/fs/9p/vfs_file.c | 36 ++----- trunk/fs/9p/vfs_inode.c | 139 ++++++++++----------------- trunk/fs/9p/vfs_inode_dotl.c | 86 +++-------------- trunk/fs/9p/vfs_super.c | 2 +- trunk/include/net/9p/9p.h | 29 ------ trunk/net/9p/trans_virtio.c | 17 +--- 13 files changed, 87 insertions(+), 271 deletions(-) diff --git a/[refs] b/[refs] index 42724aea8e38..005f1df43c66 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 28c51ee3da3be98a3d7ce54250ec0b4d99826bb7 +refs/heads/master: ff71c182f461da5ae9d2d65f8a63f5a9193b9be1 diff --git a/trunk/arch/x86/include/asm/pvclock.h b/trunk/arch/x86/include/asm/pvclock.h index c59cc97fe6c1..a518c0a45044 100644 --- a/trunk/arch/x86/include/asm/pvclock.h +++ b/trunk/arch/x86/include/asm/pvclock.h @@ -44,7 +44,7 @@ static inline u64 pvclock_scale_delta(u64 delta, u32 mul_frac, int shift) : "a" ((u32)delta), "1" ((u32)(delta >> 32)), "2" (mul_frac) ); #elif defined(__x86_64__) __asm__ ( - "mulq %[mul_frac] ; shrd $32, %[hi], %[lo]" + "mul %[mul_frac] ; shrd $32, %[hi], %[lo]" : [lo]"=a"(product), [hi]"=d"(tmp) : "0"(delta), diff --git a/trunk/arch/x86/xen/setup.c b/trunk/arch/x86/xen/setup.c index c3b8d440873c..df118a825f39 100644 --- a/trunk/arch/x86/xen/setup.c +++ b/trunk/arch/x86/xen/setup.c @@ -184,19 +184,6 @@ static unsigned long __init xen_set_identity(const struct e820entry *list, PFN_UP(start_pci), PFN_DOWN(last)); return identity; } - -static unsigned long __init xen_get_max_pages(void) -{ - unsigned long max_pages = MAX_DOMAIN_PAGES; - domid_t domid = DOMID_SELF; - int ret; - - ret = HYPERVISOR_memory_op(XENMEM_maximum_reservation, &domid); - if (ret > 0) - max_pages = ret; - return min(max_pages, MAX_DOMAIN_PAGES); -} - /** * machine_specific_memory_setup - Hook for machine specific memory setup. **/ @@ -305,12 +292,6 @@ char * __init xen_memory_setup(void) sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); - extra_limit = xen_get_max_pages(); - if (extra_limit >= max_pfn) - extra_pages = extra_limit - max_pfn; - else - extra_pages = 0; - extra_pages += xen_return_unused_memory(xen_start_info->nr_pages, &e820); /* diff --git a/trunk/arch/x86/xen/smp.c b/trunk/arch/x86/xen/smp.c index d4fc6d454f8d..e79dbb95482b 100644 --- a/trunk/arch/x86/xen/smp.c +++ b/trunk/arch/x86/xen/smp.c @@ -32,7 +32,6 @@ #include #include -#include #include "xen-ops.h" #include "mmu.h" @@ -208,15 +207,6 @@ static void __init xen_smp_prepare_cpus(unsigned int max_cpus) unsigned cpu; unsigned int i; - if (skip_ioapic_setup) { - char *m = (max_cpus == 0) ? - "The nosmp parameter is incompatible with Xen; " \ - "use Xen dom0_max_vcpus=1 parameter" : - "The noapic parameter is incompatible with Xen"; - - xen_raw_printk(m); - panic(m); - } xen_init_lock_cpu(0); smp_store_cpu_info(0); diff --git a/trunk/arch/x86/xen/xen-asm_32.S b/trunk/arch/x86/xen/xen-asm_32.S index b040b0e518ca..22a2093b5862 100644 --- a/trunk/arch/x86/xen/xen-asm_32.S +++ b/trunk/arch/x86/xen/xen-asm_32.S @@ -113,13 +113,11 @@ xen_iret_start_crit: /* * If there's something pending, mask events again so we can - * jump back into xen_hypervisor_callback. Otherwise do not - * touch XEN_vcpu_info_mask. + * jump back into xen_hypervisor_callback */ - jne 1f - movb $1, XEN_vcpu_info_mask(%eax) + sete XEN_vcpu_info_mask(%eax) -1: popl %eax + popl %eax /* * From this point on the registers are restored and the stack diff --git a/trunk/drivers/hwmon/max16065.c b/trunk/drivers/hwmon/max16065.c index d94a24fdf4ba..dd2d7b9620c2 100644 --- a/trunk/drivers/hwmon/max16065.c +++ b/trunk/drivers/hwmon/max16065.c @@ -124,7 +124,7 @@ static inline int MV_TO_LIMIT(int mv, int range) static inline int ADC_TO_CURR(int adc, int gain) { - return adc * 1400000 / gain * 255; + return adc * 1400000 / (gain * 255); } /* diff --git a/trunk/fs/9p/v9fs_vfs.h b/trunk/fs/9p/v9fs_vfs.h index 410ffd6ceb5f..46ce357ca1ab 100644 --- a/trunk/fs/9p/v9fs_vfs.h +++ b/trunk/fs/9p/v9fs_vfs.h @@ -54,9 +54,9 @@ extern struct kmem_cache *v9fs_inode_cache; struct inode *v9fs_alloc_inode(struct super_block *sb); void v9fs_destroy_inode(struct inode *inode); -struct inode *v9fs_get_inode(struct super_block *sb, int mode, dev_t); +struct inode *v9fs_get_inode(struct super_block *sb, int mode); int v9fs_init_inode(struct v9fs_session_info *v9ses, - struct inode *inode, int mode, dev_t); + struct inode *inode, int mode); void v9fs_evict_inode(struct inode *inode); ino_t v9fs_qid2ino(struct p9_qid *qid); void v9fs_stat2inode(struct p9_wstat *, struct inode *, struct super_block *); @@ -83,6 +83,4 @@ static inline void v9fs_invalidate_inode_attr(struct inode *inode) v9inode->cache_validity |= V9FS_INO_INVALID_ATTR; return; } - -int v9fs_open_to_dotl_flags(int flags); #endif diff --git a/trunk/fs/9p/vfs_file.c b/trunk/fs/9p/vfs_file.c index 62857a810a79..3c173fcc2c5a 100644 --- a/trunk/fs/9p/vfs_file.c +++ b/trunk/fs/9p/vfs_file.c @@ -65,7 +65,7 @@ int v9fs_file_open(struct inode *inode, struct file *file) v9inode = V9FS_I(inode); v9ses = v9fs_inode2v9ses(inode); if (v9fs_proto_dotl(v9ses)) - omode = v9fs_open_to_dotl_flags(file->f_flags); + omode = file->f_flags; else omode = v9fs_uflags2omode(file->f_flags, v9fs_proto_dotu(v9ses)); @@ -169,18 +169,7 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl) /* convert posix lock to p9 tlock args */ memset(&flock, 0, sizeof(flock)); - /* map the lock type */ - switch (fl->fl_type) { - case F_RDLCK: - flock.type = P9_LOCK_TYPE_RDLCK; - break; - case F_WRLCK: - flock.type = P9_LOCK_TYPE_WRLCK; - break; - case F_UNLCK: - flock.type = P9_LOCK_TYPE_UNLCK; - break; - } + flock.type = fl->fl_type; flock.start = fl->fl_start; if (fl->fl_end == OFFSET_MAX) flock.length = 0; @@ -256,7 +245,7 @@ static int v9fs_file_getlock(struct file *filp, struct file_lock *fl) /* convert posix lock to p9 tgetlock args */ memset(&glock, 0, sizeof(glock)); - glock.type = P9_LOCK_TYPE_UNLCK; + glock.type = fl->fl_type; glock.start = fl->fl_start; if (fl->fl_end == OFFSET_MAX) glock.length = 0; @@ -268,26 +257,17 @@ static int v9fs_file_getlock(struct file *filp, struct file_lock *fl) res = p9_client_getlock_dotl(fid, &glock); if (res < 0) return res; - /* map 9p lock type to os lock type */ - switch (glock.type) { - case P9_LOCK_TYPE_RDLCK: - fl->fl_type = F_RDLCK; - break; - case P9_LOCK_TYPE_WRLCK: - fl->fl_type = F_WRLCK; - break; - case P9_LOCK_TYPE_UNLCK: - fl->fl_type = F_UNLCK; - break; - } - if (glock.type != P9_LOCK_TYPE_UNLCK) { + if (glock.type != F_UNLCK) { + fl->fl_type = glock.type; fl->fl_start = glock.start; if (glock.length == 0) fl->fl_end = OFFSET_MAX; else fl->fl_end = glock.start + glock.length - 1; fl->fl_pid = glock.proc_id; - } + } else + fl->fl_type = F_UNLCK; + return res; } diff --git a/trunk/fs/9p/vfs_inode.c b/trunk/fs/9p/vfs_inode.c index e3c03db3c788..8bb5507e822f 100644 --- a/trunk/fs/9p/vfs_inode.c +++ b/trunk/fs/9p/vfs_inode.c @@ -95,18 +95,15 @@ static int unixmode2p9mode(struct v9fs_session_info *v9ses, int mode) /** * p9mode2unixmode- convert plan9 mode bits to unix mode bits * @v9ses: v9fs session information - * @stat: p9_wstat from which mode need to be derived - * @rdev: major number, minor number in case of device files. + * @mode: mode to convert * */ -static int p9mode2unixmode(struct v9fs_session_info *v9ses, - struct p9_wstat *stat, dev_t *rdev) + +static int p9mode2unixmode(struct v9fs_session_info *v9ses, int mode) { int res; - int mode = stat->mode; - res = mode & S_IALLUGO; - *rdev = 0; + res = mode & 0777; if ((mode & P9_DMDIR) == P9_DMDIR) res |= S_IFDIR; @@ -119,26 +116,9 @@ static int p9mode2unixmode(struct v9fs_session_info *v9ses, && (v9ses->nodev == 0)) res |= S_IFIFO; else if ((mode & P9_DMDEVICE) && (v9fs_proto_dotu(v9ses)) - && (v9ses->nodev == 0)) { - char type = 0, ext[32]; - int major = -1, minor = -1; - - strncpy(ext, stat->extension, sizeof(ext)); - sscanf(ext, "%c %u %u", &type, &major, &minor); - switch (type) { - case 'c': - res |= S_IFCHR; - break; - case 'b': - res |= S_IFBLK; - break; - default: - P9_DPRINTK(P9_DEBUG_ERROR, - "Unknown special type %c %s\n", type, - stat->extension); - }; - *rdev = MKDEV(major, minor); - } else + && (v9ses->nodev == 0)) + res |= S_IFBLK; + else res |= S_IFREG; if (v9fs_proto_dotu(v9ses)) { @@ -151,6 +131,7 @@ static int p9mode2unixmode(struct v9fs_session_info *v9ses, if ((mode & P9_DMSETVTX) == P9_DMSETVTX) res |= S_ISVTX; } + return res; } @@ -261,13 +242,13 @@ void v9fs_destroy_inode(struct inode *inode) } int v9fs_init_inode(struct v9fs_session_info *v9ses, - struct inode *inode, int mode, dev_t rdev) + struct inode *inode, int mode) { int err = 0; inode_init_owner(inode, NULL, mode); inode->i_blocks = 0; - inode->i_rdev = rdev; + inode->i_rdev = 0; inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; inode->i_mapping->a_ops = &v9fs_addr_operations; @@ -354,7 +335,7 @@ int v9fs_init_inode(struct v9fs_session_info *v9ses, * */ -struct inode *v9fs_get_inode(struct super_block *sb, int mode, dev_t rdev) +struct inode *v9fs_get_inode(struct super_block *sb, int mode) { int err; struct inode *inode; @@ -367,7 +348,7 @@ struct inode *v9fs_get_inode(struct super_block *sb, int mode, dev_t rdev) P9_EPRINTK(KERN_WARNING, "Problem allocating inode\n"); return ERR_PTR(-ENOMEM); } - err = v9fs_init_inode(v9ses, inode, mode, rdev); + err = v9fs_init_inode(v9ses, inode, mode); if (err) { iput(inode); return ERR_PTR(err); @@ -454,12 +435,11 @@ void v9fs_evict_inode(struct inode *inode) static int v9fs_test_inode(struct inode *inode, void *data) { int umode; - dev_t rdev; struct v9fs_inode *v9inode = V9FS_I(inode); struct p9_wstat *st = (struct p9_wstat *)data; struct v9fs_session_info *v9ses = v9fs_inode2v9ses(inode); - umode = p9mode2unixmode(v9ses, st, &rdev); + umode = p9mode2unixmode(v9ses, st->mode); /* don't match inode of different type */ if ((inode->i_mode & S_IFMT) != (umode & S_IFMT)) return 0; @@ -493,7 +473,6 @@ static struct inode *v9fs_qid_iget(struct super_block *sb, struct p9_wstat *st, int new) { - dev_t rdev; int retval, umode; unsigned long i_ino; struct inode *inode; @@ -517,8 +496,8 @@ static struct inode *v9fs_qid_iget(struct super_block *sb, * later. */ inode->i_ino = i_ino; - umode = p9mode2unixmode(v9ses, st, &rdev); - retval = v9fs_init_inode(v9ses, inode, umode, rdev); + umode = p9mode2unixmode(v9ses, st->mode); + retval = v9fs_init_inode(v9ses, inode, umode); if (retval) goto error; @@ -552,19 +531,6 @@ v9fs_inode_from_fid(struct v9fs_session_info *v9ses, struct p9_fid *fid, return inode; } -/** - * v9fs_at_to_dotl_flags- convert Linux specific AT flags to - * plan 9 AT flag. - * @flags: flags to convert - */ -static int v9fs_at_to_dotl_flags(int flags) -{ - int rflags = 0; - if (flags & AT_REMOVEDIR) - rflags |= P9_DOTL_AT_REMOVEDIR; - return rflags; -} - /** * v9fs_remove - helper function to remove files and directories * @dir: directory inode that is being deleted @@ -592,8 +558,7 @@ static int v9fs_remove(struct inode *dir, struct dentry *dentry, int flags) return retval; } if (v9fs_proto_dotl(v9ses)) - retval = p9_client_unlinkat(dfid, dentry->d_name.name, - v9fs_at_to_dotl_flags(flags)); + retval = p9_client_unlinkat(dfid, dentry->d_name.name, flags); if (retval == -EOPNOTSUPP) { /* Try the one based on path */ v9fid = v9fs_fid_clone(dentry); @@ -680,11 +645,13 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir, P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n", err); goto error; } + d_instantiate(dentry, inode); err = v9fs_fid_add(dentry, fid); if (err < 0) goto error; - d_instantiate(dentry, inode); + return ofid; + error: if (ofid) p9_client_clunk(ofid); @@ -825,7 +792,6 @@ static int v9fs_vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nameidata) { - struct dentry *res; struct super_block *sb; struct v9fs_session_info *v9ses; struct p9_fid *dfid, *fid; @@ -857,35 +823,22 @@ struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry, return ERR_PTR(result); } - /* - * Make sure we don't use a wrong inode due to parallel - * unlink. For cached mode create calls request for new - * inode. But with cache disabled, lookup should do this. - */ - if (v9ses->cache) - inode = v9fs_get_inode_from_fid(v9ses, fid, dir->i_sb); - else - inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); + + inode = v9fs_get_inode_from_fid(v9ses, fid, dir->i_sb); if (IS_ERR(inode)) { result = PTR_ERR(inode); inode = NULL; goto error; } + result = v9fs_fid_add(dentry, fid); if (result < 0) goto error_iput; + inst_out: - /* - * If we had a rename on the server and a parallel lookup - * for the new name, then make sure we instantiate with - * the new name. ie look up for a/b, while on server somebody - * moved b under k and client parallely did a lookup for - * k/b. - */ - res = d_materialise_unique(dentry, inode); - if (!IS_ERR(res)) - return res; - result = PTR_ERR(res); + d_add(dentry, inode); + return NULL; + error_iput: iput(inode); error: @@ -1049,7 +1002,7 @@ v9fs_vfs_getattr(struct vfsmount *mnt, struct dentry *dentry, return PTR_ERR(st); v9fs_stat2inode(st, dentry->d_inode, dentry->d_inode->i_sb); - generic_fillattr(dentry->d_inode, stat); + generic_fillattr(dentry->d_inode, stat); p9stat_free(st); kfree(st); @@ -1133,7 +1086,6 @@ void v9fs_stat2inode(struct p9_wstat *stat, struct inode *inode, struct super_block *sb) { - mode_t mode; char ext[32]; char tag_name[14]; unsigned int i_nlink; @@ -1169,9 +1121,31 @@ v9fs_stat2inode(struct p9_wstat *stat, struct inode *inode, inode->i_nlink = i_nlink; } } - mode = stat->mode & S_IALLUGO; - mode |= inode->i_mode & ~S_IALLUGO; - inode->i_mode = mode; + inode->i_mode = p9mode2unixmode(v9ses, stat->mode); + if ((S_ISBLK(inode->i_mode)) || (S_ISCHR(inode->i_mode))) { + char type = 0; + int major = -1; + int minor = -1; + + strncpy(ext, stat->extension, sizeof(ext)); + sscanf(ext, "%c %u %u", &type, &major, &minor); + switch (type) { + case 'c': + inode->i_mode &= ~S_IFBLK; + inode->i_mode |= S_IFCHR; + break; + case 'b': + break; + default: + P9_DPRINTK(P9_DEBUG_ERROR, + "Unknown special type %c %s\n", type, + stat->extension); + }; + inode->i_rdev = MKDEV(major, minor); + init_special_inode(inode, inode->i_mode, inode->i_rdev); + } else + inode->i_rdev = 0; + i_size_write(inode, stat->length); /* not real number of blocks, but 512 byte ones ... */ @@ -1437,8 +1411,6 @@ v9fs_vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev) int v9fs_refresh_inode(struct p9_fid *fid, struct inode *inode) { - int umode; - dev_t rdev; loff_t i_size; struct p9_wstat *st; struct v9fs_session_info *v9ses; @@ -1447,12 +1419,6 @@ int v9fs_refresh_inode(struct p9_fid *fid, struct inode *inode) st = p9_client_stat(fid); if (IS_ERR(st)) return PTR_ERR(st); - /* - * Don't update inode if the file type is different - */ - umode = p9mode2unixmode(v9ses, st, &rdev); - if ((inode->i_mode & S_IFMT) != (umode & S_IFMT)) - goto out; spin_lock(&inode->i_lock); /* @@ -1464,7 +1430,6 @@ int v9fs_refresh_inode(struct p9_fid *fid, struct inode *inode) if (v9ses->cache) inode->i_size = i_size; spin_unlock(&inode->i_lock); -out: p9stat_free(st); kfree(st); return 0; diff --git a/trunk/fs/9p/vfs_inode_dotl.c b/trunk/fs/9p/vfs_inode_dotl.c index aded79fcd5cf..b6c8ed205192 100644 --- a/trunk/fs/9p/vfs_inode_dotl.c +++ b/trunk/fs/9p/vfs_inode_dotl.c @@ -153,8 +153,7 @@ static struct inode *v9fs_qid_iget_dotl(struct super_block *sb, * later. */ inode->i_ino = i_ino; - retval = v9fs_init_inode(v9ses, inode, - st->st_mode, new_decode_dev(st->st_rdev)); + retval = v9fs_init_inode(v9ses, inode, st->st_mode); if (retval) goto error; @@ -191,58 +190,6 @@ v9fs_inode_from_fid_dotl(struct v9fs_session_info *v9ses, struct p9_fid *fid, return inode; } -struct dotl_openflag_map { - int open_flag; - int dotl_flag; -}; - -static int v9fs_mapped_dotl_flags(int flags) -{ - int i; - int rflags = 0; - struct dotl_openflag_map dotl_oflag_map[] = { - { O_CREAT, P9_DOTL_CREATE }, - { O_EXCL, P9_DOTL_EXCL }, - { O_NOCTTY, P9_DOTL_NOCTTY }, - { O_TRUNC, P9_DOTL_TRUNC }, - { O_APPEND, P9_DOTL_APPEND }, - { O_NONBLOCK, P9_DOTL_NONBLOCK }, - { O_DSYNC, P9_DOTL_DSYNC }, - { FASYNC, P9_DOTL_FASYNC }, - { O_DIRECT, P9_DOTL_DIRECT }, - { O_LARGEFILE, P9_DOTL_LARGEFILE }, - { O_DIRECTORY, P9_DOTL_DIRECTORY }, - { O_NOFOLLOW, P9_DOTL_NOFOLLOW }, - { O_NOATIME, P9_DOTL_NOATIME }, - { O_CLOEXEC, P9_DOTL_CLOEXEC }, - { O_SYNC, P9_DOTL_SYNC}, - }; - for (i = 0; i < ARRAY_SIZE(dotl_oflag_map); i++) { - if (flags & dotl_oflag_map[i].open_flag) - rflags |= dotl_oflag_map[i].dotl_flag; - } - return rflags; -} - -/** - * v9fs_open_to_dotl_flags- convert Linux specific open flags to - * plan 9 open flag. - * @flags: flags to convert - */ -int v9fs_open_to_dotl_flags(int flags) -{ - int rflags = 0; - - /* - * We have same bits for P9_DOTL_READONLY, P9_DOTL_WRONLY - * and P9_DOTL_NOACCESS - */ - rflags |= flags & O_ACCMODE; - rflags |= v9fs_mapped_dotl_flags(flags); - - return rflags; -} - /** * v9fs_vfs_create_dotl - VFS hook to create files for 9P2000.L protocol. * @dir: directory inode that is being created @@ -311,8 +258,7 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode, "Failed to get acl values in creat %d\n", err); goto error; } - err = p9_client_create_dotl(ofid, name, v9fs_open_to_dotl_flags(flags), - mode, gid, &qid); + err = p9_client_create_dotl(ofid, name, flags, mode, gid, &qid); if (err < 0) { P9_DPRINTK(P9_DEBUG_VFS, "p9_client_open_dotl failed in creat %d\n", @@ -335,10 +281,10 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode, P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n", err); goto error; } + d_instantiate(dentry, inode); err = v9fs_fid_add(dentry, fid); if (err < 0) goto error; - d_instantiate(dentry, inode); /* Now set the ACL based on the default value */ v9fs_set_create_acl(dentry, &dacl, &pacl); @@ -457,10 +403,10 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir, err); goto error; } + d_instantiate(dentry, inode); err = v9fs_fid_add(dentry, fid); if (err < 0) goto error; - d_instantiate(dentry, inode); fid = NULL; } else { /* @@ -468,7 +414,7 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir, * inode with stat. We need to get an inode * so that we can set the acl with dentry */ - inode = v9fs_get_inode(dir->i_sb, mode, 0); + inode = v9fs_get_inode(dir->i_sb, mode); if (IS_ERR(inode)) { err = PTR_ERR(inode); goto error; @@ -594,7 +540,6 @@ int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr) void v9fs_stat2inode_dotl(struct p9_stat_dotl *stat, struct inode *inode) { - mode_t mode; struct v9fs_inode *v9inode = V9FS_I(inode); if ((stat->st_result_mask & P9_STATS_BASIC) == P9_STATS_BASIC) { @@ -607,10 +552,11 @@ v9fs_stat2inode_dotl(struct p9_stat_dotl *stat, struct inode *inode) inode->i_uid = stat->st_uid; inode->i_gid = stat->st_gid; inode->i_nlink = stat->st_nlink; + inode->i_mode = stat->st_mode; + inode->i_rdev = new_decode_dev(stat->st_rdev); - mode = stat->st_mode & S_IALLUGO; - mode |= inode->i_mode & ~S_IALLUGO; - inode->i_mode = mode; + if ((S_ISBLK(inode->i_mode)) || (S_ISCHR(inode->i_mode))) + init_special_inode(inode, inode->i_mode, inode->i_rdev); i_size_write(inode, stat->st_size); inode->i_blocks = stat->st_blocks; @@ -711,14 +657,14 @@ v9fs_vfs_symlink_dotl(struct inode *dir, struct dentry *dentry, err); goto error; } + d_instantiate(dentry, inode); err = v9fs_fid_add(dentry, fid); if (err < 0) goto error; - d_instantiate(dentry, inode); fid = NULL; } else { /* Not in cached mode. No need to populate inode with stat */ - inode = v9fs_get_inode(dir->i_sb, S_IFLNK, 0); + inode = v9fs_get_inode(dir->i_sb, S_IFLNK); if (IS_ERR(inode)) { err = PTR_ERR(inode); goto error; @@ -864,17 +810,17 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode, err); goto error; } + d_instantiate(dentry, inode); err = v9fs_fid_add(dentry, fid); if (err < 0) goto error; - d_instantiate(dentry, inode); fid = NULL; } else { /* * Not in cached mode. No need to populate inode with stat. * socket syscall returns a fd, so we need instantiate */ - inode = v9fs_get_inode(dir->i_sb, mode, rdev); + inode = v9fs_get_inode(dir->i_sb, mode); if (IS_ERR(inode)) { err = PTR_ERR(inode); goto error; @@ -940,11 +886,6 @@ int v9fs_refresh_inode_dotl(struct p9_fid *fid, struct inode *inode) st = p9_client_getattr_dotl(fid, P9_STATS_ALL); if (IS_ERR(st)) return PTR_ERR(st); - /* - * Don't update inode if the file type is different - */ - if ((inode->i_mode & S_IFMT) != (st->st_mode & S_IFMT)) - goto out; spin_lock(&inode->i_lock); /* @@ -956,7 +897,6 @@ int v9fs_refresh_inode_dotl(struct p9_fid *fid, struct inode *inode) if (v9ses->cache) inode->i_size = i_size; spin_unlock(&inode->i_lock); -out: kfree(st); return 0; } diff --git a/trunk/fs/9p/vfs_super.c b/trunk/fs/9p/vfs_super.c index c70251d47ed1..feef6cdc1fd2 100644 --- a/trunk/fs/9p/vfs_super.c +++ b/trunk/fs/9p/vfs_super.c @@ -149,7 +149,7 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags, else sb->s_d_op = &v9fs_dentry_operations; - inode = v9fs_get_inode(sb, S_IFDIR | mode, 0); + inode = v9fs_get_inode(sb, S_IFDIR | mode); if (IS_ERR(inode)) { retval = PTR_ERR(inode); goto release_sb; diff --git a/trunk/include/net/9p/9p.h b/trunk/include/net/9p/9p.h index a6326ef8ade6..342dcf13d039 100644 --- a/trunk/include/net/9p/9p.h +++ b/trunk/include/net/9p/9p.h @@ -288,35 +288,6 @@ enum p9_perm_t { P9_DMSETVTX = 0x00010000, }; -/* 9p2000.L open flags */ -#define P9_DOTL_RDONLY 00000000 -#define P9_DOTL_WRONLY 00000001 -#define P9_DOTL_RDWR 00000002 -#define P9_DOTL_NOACCESS 00000003 -#define P9_DOTL_CREATE 00000100 -#define P9_DOTL_EXCL 00000200 -#define P9_DOTL_NOCTTY 00000400 -#define P9_DOTL_TRUNC 00001000 -#define P9_DOTL_APPEND 00002000 -#define P9_DOTL_NONBLOCK 00004000 -#define P9_DOTL_DSYNC 00010000 -#define P9_DOTL_FASYNC 00020000 -#define P9_DOTL_DIRECT 00040000 -#define P9_DOTL_LARGEFILE 00100000 -#define P9_DOTL_DIRECTORY 00200000 -#define P9_DOTL_NOFOLLOW 00400000 -#define P9_DOTL_NOATIME 01000000 -#define P9_DOTL_CLOEXEC 02000000 -#define P9_DOTL_SYNC 04000000 - -/* 9p2000.L at flags */ -#define P9_DOTL_AT_REMOVEDIR 0x200 - -/* 9p2000.L lock type */ -#define P9_LOCK_TYPE_RDLCK 0 -#define P9_LOCK_TYPE_WRLCK 1 -#define P9_LOCK_TYPE_UNLCK 2 - /** * enum p9_qid_t - QID types * @P9_QTDIR: directory diff --git a/trunk/net/9p/trans_virtio.c b/trunk/net/9p/trans_virtio.c index e317583fcc73..175b5135bdcf 100644 --- a/trunk/net/9p/trans_virtio.c +++ b/trunk/net/9p/trans_virtio.c @@ -263,6 +263,7 @@ p9_virtio_request(struct p9_client *client, struct p9_req_t *req) { int in, out, inp, outp; struct virtio_chan *chan = client->trans; + char *rdata = (char *)req->rc+sizeof(struct p9_fcall); unsigned long flags; size_t pdata_off = 0; struct trans_rpage_info *rpinfo = NULL; @@ -345,8 +346,7 @@ p9_virtio_request(struct p9_client *client, struct p9_req_t *req) * Arrange in such a way that server places header in the * alloced memory and payload onto the user buffer. */ - inp = pack_sg_list(chan->sg, out, - VIRTQUEUE_NUM, req->rc->sdata, 11); + inp = pack_sg_list(chan->sg, out, VIRTQUEUE_NUM, rdata, 11); /* * Running executables in the filesystem may result in * a read request with kernel buffer as opposed to user buffer. @@ -366,8 +366,8 @@ p9_virtio_request(struct p9_client *client, struct p9_req_t *req) } in += inp; } else { - in = pack_sg_list(chan->sg, out, VIRTQUEUE_NUM, - req->rc->sdata, req->rc->capacity); + in = pack_sg_list(chan->sg, out, VIRTQUEUE_NUM, rdata, + req->rc->capacity); } err = virtqueue_add_buf(chan->vq, chan->sg, out, in, req->tc); @@ -592,14 +592,7 @@ static struct p9_trans_module p9_virtio_trans = { .close = p9_virtio_close, .request = p9_virtio_request, .cancel = p9_virtio_cancel, - - /* - * We leave one entry for input and one entry for response - * headers. We also skip one more entry to accomodate, address - * that are not at page boundary, that can result in an extra - * page in zero copy. - */ - .maxsize = PAGE_SIZE * (VIRTQUEUE_NUM - 3), + .maxsize = PAGE_SIZE*VIRTQUEUE_NUM, .pref = P9_TRANS_PREF_PAYLOAD_SEP, .def = 0, .owner = THIS_MODULE,