00/19 Unionfs updates/cleanups/fixes
The following is a series of patches related to Unionfs. The main changes here are compliance with coding style and assorted cleanups, based on lkml comments and advise. Specifically, the un/likely updates from the previous series of patches was completely redone; the number of un/likely instances was reduced from 546 to 163 and what's left are considered highly unlikely (99% or higher threshold).
These patches were tested (where appropriate) on our 2.6.23-rc8 latest code, as well as the backports to 2.6.{22,21,20,19,18,9} on ext2/3/4, xfs, reiserfs, nfs2/3/4, jffs2, ramfs, tmpfs, cramfs, and squashfs (where available). See http://unionfs.filesystems.org/ to download backported unionfs code.
Please pull from the 'master' branch ofgit://git.kernel.org/pub/scm/linux/kernel/git/ezk/unionfs.git
to receive the following:
Erez Zadok (19):
Unionfs: compile if debug is off
Unionfs: add un/likely on conditionals
Unionfs: minor comment cleanups
Unionfs: use consistent printk prefixes
Unionfs: use UNIONFS_NAME macro
Unionfs: properly indent static struct
Unionfs: remove unnecessary if condition
Unionfs: use page_offset() helper
Unionfs: use pr_debug() instead of custom dprintk()
Unionfs: convert all appropriate printk's to pr_debug calls
Unionfs: add missing newlines in printk's
Unionfs: update/assign a KERN_* level to all printk statements
Unionfs: remove periods from the end of printk strings
Unionfs: use braces in both branches of conditionals
Unionfs: coding style: proper spacing
Unionfs: coding style: take assignments out of "if" conditions
Unionfs: coding style: avoid multiple assignments on same line
Unionfs: coding style: miscellaneous fixes
Unionfs: coding style: avoid lines longer than 80 chars
Makefile | 4 commonfops.c | 86 ++++++------ copyup.c | 31 ++-- debug.c | 406 +++++++++++++++++++++++++++++------------------------------ dentry.c | 66 ++++----- dirfops.c | 32 ++-- dirhelper.c | 13 + fanout.h | 11 + file.c | 29 ++-- inode.c | 82 ++++++----- lookup.c | 29 ++-- main.c | 80 ++++++----- mmap.c | 18 +- rdstate.c | 18 +- rename.c | 59 ++++---- subr.c | 13 + super.c | 102 +++++++------- union.h | 52 +++---- unlink.c | 22 +-- xattr.c | 16 +- 20 files changed, 622 insertions(+), 547 deletions(-)
---
Erez Zadok
[email protected]
PATCH 1/19 Unionfs: compile if debug is off
--- fs/unionfs/union.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
fs/unionfs/union.h +1 -0
@@ -556,6 +556,7 @@ extern void __show_inode_counts(const struct inode *inode,#define unionfs_check_inode (i) do { } while(0)#define unionfs_check_dentry (d) do { } while(0)#define unionfs_check_file (f) do { } while(0) +#define unionfs_check_nd (n) do { } while(0)#define show_branch_counts (sb) do { } while(0)#define show_inode_times (i) do { } while(0)#define show_dinode_times (d) do { } while(0)
Signature · 1 line
1.5.2.2
PATCH 2/19 Unionfs: add un/likely on conditionals
In reply to Erez Zadok--- fs/unionfs/commonfops.c | 34 +++++++------- fs/unionfs/copyup.c | 18 ++++---- fs/unionfs/debug.c | 108 +++++++++++++++++++++++++---------------------- fs/unionfs/dentry.c | 25 ++++++----- fs/unionfs/dirfops.c | 6 +- fs/unionfs/dirhelper.c | 6 +- fs/unionfs/fanout.h | 6 +- fs/unionfs/file.c | 16 ++++---- fs/unionfs/inode.c | 42 +++++++++--------- fs/unionfs/lookup.c | 12 +++--- fs/unionfs/main.c | 26 ++++++------ fs/unionfs/mmap.c | 4 +- fs/unionfs/rdstate.c | 8 ++-- fs/unionfs/rename.c | 14 +++--- fs/unionfs/subr.c | 8 ++-- fs/unionfs/super.c | 24 +++++----- fs/unionfs/unlink.c | 4 +- fs/unionfs/xattr.c | 10 ++-- 18 files changed, 189 insertions(+), 182 deletions(-)
fs/unionfs/commonfops.c +17 -17
@@ -74,7 +74,7 @@ retry: err =copyup_named_file (dentry->d_parent->d_inode, file, name, bstart, bindex, file->f_path.dentry->d_inode->i_size);if (err) { -if (err == -EEXIST ) +if (unlikely (err == -EEXIST )) goto retry; goto out; }
@@ -126,7 +126,7 @@ static void cleanup_file(struct file *file)*/ old_bid =UNIONFS_F (file)->saved_branch_ids[bindex]; i =branch_id_to_idx (sb, old_bid); -if (i <0 ) { +if (unlikely (i <0 )) {printk (KERN_ERR "unionfs: no superblock for " "file %p\n" , file);continue ;
@@ -317,8 +317,8 @@ int unionfs_file_revalidate(struct file *file, bool willwrite)* First revalidate the dentry inside struct file, * but not unhashed dentries. */ -if (!d_deleted (dentry) && - !__unionfs_d_revalidate_chain (dentry,NULL , willwrite)) { +if (unlikely (!d_deleted (dentry) && + !__unionfs_d_revalidate_chain (dentry,NULL , willwrite))) { err = -ESTALE ; goto out_nofree; }
@@ -335,8 +335,8 @@ int unionfs_file_revalidate(struct file *file, bool willwrite)* someone has copied up this file from underneath us, we also need * to refresh things. */ -if (!d_deleted (dentry) && - (sbgen > fgen ||dbstart (dentry) !=fbstart (file))) { +if (unlikely (!d_deleted (dentry) && + (sbgen > fgen ||dbstart (dentry) !=fbstart (file)))) {/* save orig branch ID */ int orig_brid =UNIONFS_F (file)->saved_branch_ids[fbstart (file)];
@@ -349,13 +349,13 @@ int unionfs_file_revalidate(struct file *file, bool willwrite) size =sizeof (struct file *) *sbmax (sb);UNIONFS_F (file)->lower_files =kzalloc (size,GFP_KERNEL ); -if (!UNIONFS_F (file)->lower_files) { +if (unlikely (!UNIONFS_F (file)->lower_files)) { err = -ENOMEM ; goto out; } size =sizeof (int ) *sbmax (sb);UNIONFS_F (file)->saved_branch_ids =kzalloc (size,GFP_KERNEL ); -if (!UNIONFS_F (file)->saved_branch_ids) { +if (unlikely (!UNIONFS_F (file)->saved_branch_ids)) { err = -ENOMEM ; goto out; }
@@ -373,7 +373,7 @@ int unionfs_file_revalidate(struct file *file, bool willwrite) goto out; new_brid =UNIONFS_F (file)-> saved_branch_ids[fbstart (file)]; -if (new_brid != orig_brid && sbgen > fgen) { +if (unlikely (new_brid != orig_brid && sbgen > fgen)) {/* * If we re-opened the file on a different * branch than the original one, and this
@@ -520,7 +520,7 @@ int unionfs_open(struct inode *inode, struct file *file) file->private_data =kzalloc (sizeof (struct unionfs_file_info ),GFP_KERNEL ); -if (!UNIONFS_F (file)) { +if (unlikely (!UNIONFS_F (file))) { err = -ENOMEM ; goto out_nofree; }
@@ -531,13 +531,13 @@ int unionfs_open(struct inode *inode, struct file *file) size =sizeof (struct file *) *sbmax (inode->i_sb);UNIONFS_F (file)->lower_files =kzalloc (size,GFP_KERNEL ); -if (!UNIONFS_F (file)->lower_files) { +if (unlikely (!UNIONFS_F (file)->lower_files)) { err = -ENOMEM ; goto out; } size =sizeof (int ) *sbmax (inode->i_sb);UNIONFS_F (file)->saved_branch_ids =kzalloc (size,GFP_KERNEL ); -if (!UNIONFS_F (file)->saved_branch_ids) { +if (unlikely (!UNIONFS_F (file)->saved_branch_ids)) { err = -ENOMEM ; goto out; }
@@ -612,7 +612,7 @@ int unionfs_file_release(struct inode *inode, struct file *file)* This is important for open-but-unlinked files, as well as mmap * support. */ -if ((err =unionfs_file_revalidate (file, true))) +if (unlikely ((err =unionfs_file_revalidate (file, true)))) goto out;unionfs_check_file (file); fileinfo =UNIONFS_F (file);
@@ -716,7 +716,7 @@ static int unionfs_ioctl_queryfile(struct file *file, unsigned int cmd, lower_dentry =unionfs_lower_dentry_idx (dentry, bindex);if (!lower_dentry)continue ; -if (lower_dentry->d_inode) +if (likely (lower_dentry->d_inode))FD_SET (bindex, &branchlist);/* purge any lower objects after partial_lookup */ if (bindex < orig_bstart || bindex > orig_bend) {
@@ -739,7 +739,7 @@ static int unionfs_ioctl_queryfile(struct file *file, unsigned int cmd,ibend (dentry->d_inode) = orig_bend; err =copy_to_user ((void __user *)arg, &branchlist,sizeof (fd_set)); -if (err) +if (unlikely (err)) err = -EFAULT ; out:
@@ -753,7 +753,7 @@ long unionfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg)unionfs_read_lock (file->f_path.dentry->d_sb); -if ((err =unionfs_file_revalidate (file, true))) +if (unlikely ((err =unionfs_file_revalidate (file, true)))) goto out;/* check if asked for local commands */
@@ -791,7 +791,7 @@ int unionfs_flush(struct file *file, fl_owner_t id)unionfs_read_lock (dentry->d_sb); -if ((err =unionfs_file_revalidate (file, true))) +if (unlikely ((err =unionfs_file_revalidate (file, true)))) goto out;unionfs_check_file (file);
fs/unionfs/copyup.c +9 -9
@@ -43,7 +43,7 @@ static int copyup_xattrs(struct dentry *old_lower_dentry,/* allocate space for the actual list */ name_list =unionfs_xattr_alloc (list_size +1 ,XATTR_LIST_MAX ); -if (!name_list ||IS_ERR (name_list)) { +if (unlikely (!name_list ||IS_ERR (name_list))) { err =PTR_ERR (name_list); goto out; }
@@ -59,7 +59,7 @@ static int copyup_xattrs(struct dentry *old_lower_dentry,/* allocate space to hold each xattr's value */ attr_value =unionfs_xattr_alloc (XATTR_SIZE_MAX ,XATTR_SIZE_MAX ); -if (!attr_value ||IS_ERR (attr_value)) { +if (unlikely (!attr_value ||IS_ERR (attr_value))) { err =PTR_ERR (name_list); goto out; }
@@ -198,7 +198,7 @@ static int __copyup_ndentry(struct dentry *old_lower_dentry, }else if (S_ISREG (old_mode)) {struct nameidata nd; err =init_lower_nd (&nd,LOOKUP_CREATE ); -if (err <0 ) +if (unlikely (err <0 )) goto out; args.create.nd = &nd; args.create.parent = new_lower_parent_dentry->d_inode;
@@ -245,7 +245,7 @@ static int __copyup_reg_data(struct dentry *dentry, err =PTR_ERR (input_file); goto out; } -if (!input_file->f_op || !input_file->f_op->read) { +if (unlikely (!input_file->f_op || !input_file->f_op->read)) { err = -EINVAL ; goto out_close_in; }
@@ -260,14 +260,14 @@ static int __copyup_reg_data(struct dentry *dentry, err =PTR_ERR (output_file); goto out_close_in2; } -if (!output_file->f_op || !output_file->f_op->write) { +if (unlikely (!output_file->f_op || !output_file->f_op->write)) { err = -EINVAL ; goto out_close_out; }/* allocating a buffer */ buf =kmalloc (PAGE_SIZE ,GFP_KERNEL ); -if (!buf) { +if (unlikely (!buf)) { err = -ENOMEM ; goto out_close_out; }
@@ -412,7 +412,7 @@ int copyup_dentry(struct inode *dir, struct dentry *dentry, int bstart,if (S_ISLNK (old_lower_dentry->d_inode->i_mode)) { symbuf =kmalloc (PATH_MAX ,GFP_KERNEL ); -if (!symbuf) { +if (unlikely (!symbuf)) {__clear (dentry, old_lower_dentry, old_bstart, old_bend, new_lower_dentry, new_bindex);
@@ -692,7 +692,7 @@ struct dentry *create_parents(struct inode *dir, struct dentry *dentry,/* There is no sense allocating any less than the minimum. */ nr_dentry =1 ; path =kmalloc (nr_dentry *sizeof (struct dentry *),GFP_KERNEL ); -if (!path) +if (unlikely (!path)) goto out;/* assume the negative dentry of unionfs as the parent dentry */
@@ -725,7 +725,7 @@ struct dentry *create_parents(struct inode *dir, struct dentry *dentry, nr_dentry *=2 ; p =krealloc (path, nr_dentry *sizeof (struct dentry *),GFP_KERNEL ); -if (!p) { +if (unlikely (!p)) { lower_dentry =ERR_PTR (-ENOMEM ); goto out; }
fs/unionfs/debug.c +57 -51
303 lines not on this page · raw message
fs/unionfs/dentry.c +13 -12
@@ -62,7 +62,7 @@ static bool __unionfs_d_revalidate_one(struct dentry *dentry,* revalidation to be done, because this file does not exist within * the namespace, and Unionfs operates on the namespace, not data. */ -if (sbgen != dgen) { +if (unlikely (sbgen != dgen)) {struct dentry *result;int pdgen;
@@ -138,7 +138,7 @@ static bool __unionfs_d_revalidate_one(struct dentry *dentry, dentry = result; } -if (positive &&UNIONFS_I (dentry->d_inode)->stale) { +if (unlikely (positive &&UNIONFS_I (dentry->d_inode)->stale)) {make_bad_inode (dentry->d_inode);d_drop (dentry); valid = false;
@@ -216,16 +216,16 @@ bool is_newer_lower(const struct dentry *dentry)* lower inode's data has changed, but checking for changed * ctime and mtime on the lower inode should be enough. */ -if (timespec_compare (&inode->i_mtime, - &lower_inode->i_mtime) <0 ) { +if (unlikely (timespec_compare (&inode->i_mtime, + &lower_inode->i_mtime) <0 )) {printk ("unionfs: new lower inode mtime " "(bindex=%d, name=%s)\n" , bindex, dentry->d_name.name);show_dinode_times (dentry);return true;/* mtime changed! */ } -if (timespec_compare (&inode->i_ctime, - &lower_inode->i_ctime) <0 ) { +if (unlikely (timespec_compare (&inode->i_ctime, + &lower_inode->i_ctime) <0 )) {printk ("unionfs: new lower inode ctime " "(bindex=%d, name=%s)\n" , bindex, dentry->d_name.name);
@@ -293,7 +293,7 @@ bool __unionfs_d_revalidate_chain(struct dentry *dentry, struct nameidata *nd, dtmp = dentry->d_parent; dgen =atomic_read (&UNIONFS_D (dtmp)->generation);/* XXX: should we check if is_newer_lower all the way up? */ -if (is_newer_lower (dtmp)) { +if (unlikely (is_newer_lower (dtmp))) {/* * Special case: the root dentry's generation number must * always be valid, but its lower inode times don't have to
@@ -327,7 +327,7 @@ bool __unionfs_d_revalidate_chain(struct dentry *dentry, struct nameidata *nd,* and short lived, so locality will be better. */ chain =kzalloc (chain_len *sizeof (struct dentry *),GFP_KERNEL ); -if (!chain) { +if (unlikely (!chain)) {printk ("unionfs: no more memory in %s\n" , __FUNCTION__); goto out; }
@@ -364,7 +364,7 @@ bool __unionfs_d_revalidate_chain(struct dentry *dentry, struct nameidata *nd, }unionfs_unlock_dentry (chain[i]); -if (!valid) +if (unlikely (!valid)) goto out_free; }
@@ -373,7 +373,8 @@ out_this:/* finally, lock this dentry and revalidate it */ verify_locked (dentry); dgen =atomic_read (&UNIONFS_D (dentry)->generation); -if (is_newer_lower (dentry)) { + +if (unlikely (is_newer_lower (dentry))) {/* root dentry special case as aforementioned */ if (IS_ROOT (dentry))unionfs_copy_attr_times (dentry->d_inode);
@@ -425,7 +426,7 @@ static int unionfs_d_revalidate(struct dentry *dentry, struct nameidata *nd)unionfs_lock_dentry (dentry); err =__unionfs_d_revalidate_chain (dentry, nd, false);unionfs_unlock_dentry (dentry); -if (err >0 ) {/* true==1: dentry is valid */ +if (likely (err >0 )) {/* true==1: dentry is valid */ unionfs_check_dentry (dentry);unionfs_check_nd (nd); }
@@ -447,7 +448,7 @@ static void unionfs_d_release(struct dentry *dentry)unionfs_check_dentry (dentry);/* this could be a negative dentry, so check first */ -if (!UNIONFS_D (dentry)) { +if (unlikely (!UNIONFS_D (dentry))) {printk (KERN_DEBUG "unionfs: dentry without private data: %.*s\n" , dentry->d_name.len, dentry->d_name.name); goto out;
fs/unionfs/dirfops.c +3 -3
@@ -99,7 +99,7 @@ static int unionfs_readdir(struct file *file, void *dirent, filldir_t filldir)unionfs_read_lock (file->f_path.dentry->d_sb); -if ((err =unionfs_file_revalidate (file, false))) +if (unlikely ((err =unionfs_file_revalidate (file, false)))) goto out; inode = file->f_path.dentry->d_inode;
@@ -110,7 +110,7 @@ static int unionfs_readdir(struct file *file, void *dirent, filldir_t filldir) goto out; }else if (file->f_pos >0 ) { uds =find_rdstate (inode, file->f_pos); -if (!uds) { +if (unlikely (!uds)) { err = -ESTALE ; goto out; }
@@ -201,7 +201,7 @@ static loff_t unionfs_dir_llseek(struct file *file, loff_t offset, int origin)unionfs_read_lock (file->f_path.dentry->d_sb); -if ((err =unionfs_file_revalidate (file, false))) +if (unlikely ((err =unionfs_file_revalidate (file, false)))) goto out; rdstate =UNIONFS_F (file)->rdstate;
fs/unionfs/dirhelper.c +3 -3
@@ -43,7 +43,7 @@ int do_delete_whiteouts(struct dentry *dentry, int bindex, err = -ENOMEM ; name =__getname (); -if (!name) +if (unlikely (!name)) goto out;strcpy (name,UNIONFS_WHPFX ); p = name +UNIONFS_WHLEN ;
@@ -204,14 +204,14 @@ int check_empty(struct dentry *dentry, struct unionfs_dir_state **namelist) bend = bopaque; buf =kmalloc (sizeof (struct unionfs_rdutil_callback ),GFP_KERNEL ); -if (!buf) { +if (unlikely (!buf)) { err = -ENOMEM ; goto out; } buf->err =0 ; buf->mode =RD_CHECK_EMPTY ; buf->rdstate =alloc_rdstate (dentry->d_inode, bstart); -if (!buf->rdstate) { +if (unlikely (!buf->rdstate)) { err = -ENOMEM ; goto out; }
fs/unionfs/fanout.h +3 -3
@@ -314,11 +314,11 @@ static inline void unionfs_copy_attr_times(struct inode *upper) lower =unionfs_lower_inode_idx (upper, bindex);if (!lower)continue ;/* not all lower dir objects may exist */ -if (timespec_compare (&upper->i_mtime, &lower->i_mtime) <0 ) +if (unlikely (timespec_compare (&upper->i_mtime, &lower->i_mtime) <0 )) upper->i_mtime = lower->i_mtime; -if (timespec_compare (&upper->i_ctime, &lower->i_ctime) <0 ) +if (unlikely (timespec_compare (&upper->i_ctime, &lower->i_ctime) <0 )) upper->i_ctime = lower->i_ctime; -if (timespec_compare (&upper->i_atime, &lower->i_atime) <0 ) +if (unlikely (timespec_compare (&upper->i_atime, &lower->i_atime) <0 )) upper->i_atime = lower->i_atime; } }
fs/unionfs/file.c +8 -8
@@ -24,7 +24,7 @@ static ssize_t unionfs_read(struct file *file, char __user *buf,int err;unionfs_read_lock (file->f_path.dentry->d_sb); -if ((err =unionfs_file_revalidate (file, false))) +if (unlikely ((err =unionfs_file_revalidate (file, false)))) goto out;unionfs_check_file (file);
@@ -47,7 +47,7 @@ static ssize_t unionfs_aio_read(struct kiocb *iocb, const struct iovec *iov,struct file *file = iocb->ki_filp;unionfs_read_lock (file->f_path.dentry->d_sb); -if ((err =unionfs_file_revalidate (file, false))) +if (unlikely ((err =unionfs_file_revalidate (file, false)))) goto out;unionfs_check_file (file);
@@ -72,7 +72,7 @@ static ssize_t unionfs_write(struct file *file, const char __user *buf,int err =0 ;unionfs_read_lock (file->f_path.dentry->d_sb); -if ((err =unionfs_file_revalidate (file, true))) +if (unlikely ((err =unionfs_file_revalidate (file, true)))) goto out;unionfs_check_file (file);
@@ -104,7 +104,7 @@ static int unionfs_mmap(struct file *file, struct vm_area_struct *vma)/* This might be deferred to mmap's writepage */ willwrite = ((vma->vm_flags |VM_SHARED |VM_WRITE ) == vma->vm_flags); -if ((err =unionfs_file_revalidate (file, willwrite))) +if (unlikely ((err =unionfs_file_revalidate (file, willwrite)))) goto out;unionfs_check_file (file);
@@ -149,7 +149,7 @@ int unionfs_fsync(struct file *file, struct dentry *dentry, int datasync)int err = -EINVAL ;unionfs_read_lock (file->f_path.dentry->d_sb); -if ((err =unionfs_file_revalidate (file, true))) +if (unlikely ((err =unionfs_file_revalidate (file, true)))) goto out;unionfs_check_file (file);
@@ -159,7 +159,7 @@ int unionfs_fsync(struct file *file, struct dentry *dentry, int datasync) goto out; inode = dentry->d_inode; -if (!inode) { +if (unlikely (!inode)) {printk (KERN_ERR "unionfs: null lower inode in unionfs_fsync\n" ); goto out;
@@ -196,7 +196,7 @@ int unionfs_fasync(int fd, struct file *file, int flag)int err =0 ;unionfs_read_lock (file->f_path.dentry->d_sb); -if ((err =unionfs_file_revalidate (file, true))) +if (unlikely ((err =unionfs_file_revalidate (file, true)))) goto out;unionfs_check_file (file);
@@ -207,7 +207,7 @@ int unionfs_fasync(int fd, struct file *file, int flag) dentry = file->f_path.dentry; inode = dentry->d_inode; -if (!inode) { +if (unlikely (!inode)) {printk (KERN_ERR "unionfs: null lower inode in unionfs_fasync\n" ); goto out;
fs/unionfs/inode.c +21 -21
141 lines not on this page · raw message
fs/unionfs/lookup.c +6 -6
@@ -119,12 +119,12 @@ struct dentry *unionfs_lookup_backend(struct dentry *dentry,case INTERPOSE_PARTIAL :break ;case INTERPOSE_LOOKUP : -if ((err =new_dentry_private_data (dentry))) +if (unlikely ((err =new_dentry_private_data (dentry)))) goto out;break ;default :/* default: can only be INTERPOSE_REVAL/REVAL_NEG */ -if ((err =realloc_dentry_private_data (dentry))) +if (unlikely ((err =realloc_dentry_private_data (dentry)))) goto out;break ; }
@@ -189,7 +189,7 @@ struct dentry *unionfs_lookup_backend(struct dentry *dentry,/* Reuse the whiteout name because its value doesn't change. */ if (!whname) { whname =alloc_whname (name, namelen); -if (IS_ERR (whname)) { +if (unlikely (IS_ERR (whname))) { err =PTR_ERR (whname); goto out_free; }
@@ -498,7 +498,7 @@ static inline int __realloc_dentry_private_data(struct dentry *dentry) size =sizeof (struct path ) *sbmax (dentry->d_sb); p =krealloc (info->lower_paths, size,GFP_ATOMIC ); -if (!p) +if (unlikely (!p))return -ENOMEM ; info->lower_paths = p;
@@ -534,7 +534,7 @@ int new_dentry_private_data(struct dentry *dentry)BUG_ON (info); info =kmem_cache_alloc (unionfs_dentry_cachep,GFP_ATOMIC ); -if (!info) +if (unlikely (!info))return -ENOMEM ;mutex_init (&info->lock);
@@ -614,7 +614,7 @@ int init_lower_nd(struct nameidata *nd, unsigned int flags) nd->intent.open.flags |= (FMODE_READ |FMODE_WRITE );#ifdef ALLOC_LOWER_ND_FILE file =kzalloc (sizeof (struct file ),GFP_KERNEL ); -if (!file) { +if (unlikely (!file)) { err = -ENOMEM ;break ;/* exit switch statement and thus return */ }
fs/unionfs/main.c +13 -13
@@ -122,7 +122,7 @@ struct dentry *unionfs_interpose(struct dentry *dentry, struct super_block *sb,UNIONFS_I (inode)->lower_inodes =kcalloc (sbmax (sb),sizeof (struct inode *),GFP_KERNEL ); -if (!UNIONFS_I (inode)->lower_inodes) { +if (unlikely (!UNIONFS_I (inode)->lower_inodes)) { err = -ENOMEM ; goto out; }
@@ -319,14 +319,14 @@ static int parse_dirs_option(struct super_block *sb, struct unionfs_dentry_info/* allocate space for underlying pointers to lower dentry */ UNIONFS_SB (sb)->data =kcalloc (branches,sizeof (struct unionfs_data ),GFP_KERNEL ); -if (!UNIONFS_SB (sb)->data) { +if (unlikely (!UNIONFS_SB (sb)->data)) { err = -ENOMEM ; goto out; } lower_root_info->lower_paths =kcalloc (branches,sizeof (struct path ),GFP_KERNEL ); -if (!lower_root_info->lower_paths) { +if (unlikely (!lower_root_info->lower_paths)) { err = -ENOMEM ; goto out; }
@@ -462,7 +462,7 @@ static struct unionfs_dentry_info *unionfs_parse_options( err = -ENOMEM ; lower_root_info =kzalloc (sizeof (struct unionfs_dentry_info ),GFP_KERNEL ); -if (!lower_root_info) +if (unlikely (!lower_root_info)) goto out_error; lower_root_info->bstart =-1 ; lower_root_info->bend =-1 ;
@@ -567,7 +567,7 @@ static struct dentry *unionfs_d_alloc_root(struct super_block *sb)static const struct qstr name = {.name ="/" ,.len =1 }; ret =d_alloc (NULL , &name); -if (ret) { +if (likely (ret)) { ret->d_op = &unionfs_dops; ret->d_sb = sb; ret->d_parent = ret;
@@ -596,7 +596,7 @@ static int unionfs_read_super(struct super_block *sb, void *raw_data,/* Allocate superblock private data */ sb->s_fs_info =kzalloc (sizeof (struct unionfs_sb_info ),GFP_KERNEL ); -if (!UNIONFS_SB (sb)) { +if (unlikely (!UNIONFS_SB (sb))) {printk (KERN_WARNING "unionfs: read_super: out of memory\n" ); err = -ENOMEM ; goto out;
@@ -637,14 +637,14 @@ static int unionfs_read_super(struct super_block *sb, void *raw_data,/* See comment next to the definition of unionfs_d_alloc_root */ sb->s_root =unionfs_d_alloc_root (sb); -if (!sb->s_root) { +if (unlikely (!sb->s_root)) { err = -ENOMEM ; goto out_dput; }/* link the upper and lower dentries */ sb->s_root->d_fsdata =NULL ; -if ((err =new_dentry_private_data (sb->s_root))) +if (unlikely ((err =new_dentry_private_data (sb->s_root)))) goto out_freedpd;/* Set the lower dentries for s_root */
@@ -734,17 +734,17 @@ static int __init init_unionfs_fs(void)printk ("Registering unionfs " UNIONFS_VERSION "\n" ); -if ((err =unionfs_init_filldir_cache ())) +if (unlikely ((err =unionfs_init_filldir_cache ()))) goto out; -if ((err =unionfs_init_inode_cache ())) +if (unlikely ((err =unionfs_init_inode_cache ()))) goto out; -if ((err =unionfs_init_dentry_cache ())) +if (unlikely ((err =unionfs_init_dentry_cache ()))) goto out; -if ((err =init_sioq ())) +if (unlikely ((err =init_sioq ()))) goto out; err =register_filesystem (&unionfs_fs_type); out: -if (err) { +if (unlikely (err)) {stop_sioq ();unionfs_destroy_filldir_cache ();unionfs_destroy_inode_cache ();
fs/unionfs/mmap.c +2 -2
@@ -212,7 +212,7 @@ static int unionfs_readpage(struct file *file, struct page *page)int err;unionfs_read_lock (file->f_path.dentry->d_sb); -if ((err =unionfs_file_revalidate (file, false))) +if (unlikely ((err =unionfs_file_revalidate (file, false)))) goto out;unionfs_check_file (file);
@@ -276,7 +276,7 @@ static int unionfs_commit_write(struct file *file, struct page *page,BUG_ON (file ==NULL );unionfs_read_lock (file->f_path.dentry->d_sb); -if ((err =unionfs_file_revalidate (file, true))) +if (unlikely ((err =unionfs_file_revalidate (file, true)))) goto out;unionfs_check_file (file);
fs/unionfs/rdstate.c +4 -4
@@ -136,7 +136,7 @@ struct unionfs_dir_state *alloc_rdstate(struct inode *inode, int bindex)sizeof (struct list_head ); rdstate =kmalloc (mallocsize,GFP_KERNEL ); -if (!rdstate) +if (unlikely (!rdstate))return NULL ;spin_lock (&UNIONFS_I (inode)->rdlock);
@@ -217,7 +217,7 @@ struct filldir_node *find_filldir_node(struct unionfs_dir_state *rdstate,* if the duplicate is in this branch, then the file * system is corrupted. */ -if (cursor->bindex == rdstate->bindex) { +if (unlikely (cursor->bindex == rdstate->bindex)) { printk(KERN_DEBUG "unionfs: filldir: possible " "I/O error: a file is duplicated " "in the same branch %d: %s\n",
@@ -249,7 +249,7 @@ int add_filldir_node(struct unionfs_dir_state *rdstate, const char *name, head = &(rdstate->list[index]); new =kmem_cache_alloc (unionfs_filldir_cachep,GFP_KERNEL ); -if (!new) { +if (unlikely (!new)) { err = -ENOMEM ; goto out; }
@@ -264,7 +264,7 @@ int add_filldir_node(struct unionfs_dir_state *rdstate, const char *name, new->name = new->iname; else { new->name =kmalloc (namelen +1 ,GFP_KERNEL ); -if (!new->name) { +if (unlikely (!new->name)) {kmem_cache_free (unionfs_filldir_cachep, new); new =NULL ; goto out;
fs/unionfs/rename.c +7 -7
@@ -50,7 +50,7 @@ static int __unionfs_rename(struct inode *old_dir, struct dentry *old_dentry, wh_name =alloc_whname (new_dentry->d_name.name, new_dentry->d_name.len); -if (IS_ERR (wh_name)) { +if (unlikely (IS_ERR (wh_name))) { err =PTR_ERR (wh_name); goto out; }
@@ -105,7 +105,7 @@ static int __unionfs_rename(struct inode *old_dir, struct dentry *old_dentry, whname =alloc_whname (old_dentry->d_name.name, old_dentry->d_name.len); err =PTR_ERR (whname); -if (IS_ERR (whname)) +if (unlikely (IS_ERR (whname))) goto out_unlock; *wh_old = lookup_one_len(whname, lower_old_dir_dentry, old_dentry->d_name.len +
@@ -265,7 +265,7 @@ static int do_unionfs_rename(struct inode *old_dir, goto out; } err =init_lower_nd (&nd,LOOKUP_CREATE ); -if (err <0 ) +if (unlikely (err <0 )) goto out; lower_parent =lock_parent (wh_old); local_err = vfs_create(lower_parent->d_inode, wh_old, S_IRUGO,
@@ -351,7 +351,7 @@ static struct dentry *lookup_whiteout(struct dentry *dentry)struct dentry *parent, *lower_parent, *wh_dentry; whname =alloc_whname (dentry->d_name.name, dentry->d_name.len); -if (IS_ERR (whname)) +if (unlikely (IS_ERR (whname)))return (void *)whname; parent =dget_parent (dentry);
@@ -416,12 +416,12 @@ int unionfs_rename(struct inode *old_dir, struct dentry *old_dentry,unionfs_read_lock (old_dentry->d_sb);unionfs_double_lock_dentry (old_dentry, new_dentry); -if (!__unionfs_d_revalidate_chain (old_dentry,NULL , false)) { +if (unlikely (!__unionfs_d_revalidate_chain (old_dentry,NULL , false))) { err = -ESTALE ; goto out; } -if (!d_deleted (new_dentry) && new_dentry->d_inode && - !__unionfs_d_revalidate_chain (new_dentry,NULL , false)) { +if (unlikely (!d_deleted (new_dentry) && new_dentry->d_inode && + !__unionfs_d_revalidate_chain (new_dentry,NULL , false))) { err = -ESTALE ; goto out; }
fs/unionfs/subr.c +4 -4
@@ -40,7 +40,7 @@ int create_whiteout(struct dentry *dentry, int start)/* create dentry's whiteout equivalent */ name =alloc_whname (dentry->d_name.name, dentry->d_name.len); -if (IS_ERR (name)) { +if (unlikely (IS_ERR (name))) { err =PTR_ERR (name); goto out; }
@@ -84,7 +84,7 @@ int create_whiteout(struct dentry *dentry, int start) } err =init_lower_nd (&nd,LOOKUP_CREATE ); -if (err <0 ) +if (unlikely (err <0 )) goto out; lower_dir_dentry =lock_parent (lower_wh_dentry);if (!(err =is_robranch_super (dentry->d_sb, bindex)))
@@ -172,7 +172,7 @@ int make_dir_opaque(struct dentry *dentry, int bindex) } err =init_lower_nd (&nd,LOOKUP_CREATE ); -if (err <0 ) +if (unlikely (err <0 )) goto out;if (!diropq->d_inode) err =vfs_create (lower_dir, diropq,S_IRUGO , &nd);
@@ -213,7 +213,7 @@ char *alloc_whname(const char *name, int len)char *buf; buf =kmalloc (len +UNIONFS_WHLEN +1 ,GFP_KERNEL ); -if (!buf) +if (unlikely (!buf))return ERR_PTR (-ENOMEM );strcpy (buf,UNIONFS_WHPFX );
fs/unionfs/super.c +12 -12
@@ -44,7 +44,7 @@ static void unionfs_read_inode(struct inode *inode) size =sbmax (inode->i_sb) *sizeof (struct inode *); info->lower_inodes =kzalloc (size,GFP_KERNEL ); -if (!info->lower_inodes) { +if (unlikely (!info->lower_inodes)) {printk (KERN_ERR "unionfs: no kernel memory when allocating " "lower-pointer array!\n" );BUG ();
@@ -98,7 +98,7 @@ static void unionfs_put_super(struct super_block *sb)/* Make sure we have no leaks of branchget/branchput. */ for (bindex = bstart; bindex <= bend; bindex++) -if (branch_count (sb, bindex) !=0 ) { +if (unlikely (branch_count (sb, bindex) !=0 )) {printk ("unionfs: branch %d has %d references left!\n" , bindex,branch_count (sb, bindex)); leaks =1 ;
@@ -126,7 +126,7 @@ static int unionfs_statfs(struct dentry *dentry, struct kstatfs *buf)unionfs_read_lock (sb);unionfs_lock_dentry (dentry); -if (!__unionfs_d_revalidate_chain (dentry,NULL , false)) { +if (unlikely (!__unionfs_d_revalidate_chain (dentry,NULL , false))) { err = -ESTALE ; goto out; }
@@ -474,7 +474,7 @@ static int unionfs_remount_fs(struct super_block *sb, int *flags,* strsep modifies the string and we need it later. */ optionstmp = tmp_to_free =kstrdup (options,GFP_KERNEL ); -if (!optionstmp) { +if (unlikely (!optionstmp)) { err = -ENOMEM ; goto out_free; }
@@ -521,14 +521,14 @@ static int unionfs_remount_fs(struct super_block *sb, int *flags,/* allocate space for new pointers to lower dentry */ tmp_data =kcalloc (max_branches,sizeof (struct unionfs_data ),GFP_KERNEL ); -if (!tmp_data) { +if (unlikely (!tmp_data)) { err = -ENOMEM ; goto out_free; }/* allocate space for new pointers to lower paths */ tmp_lower_paths =kcalloc (max_branches,sizeof (struct path ),GFP_KERNEL ); -if (!tmp_lower_paths) { +if (unlikely (!tmp_lower_paths)) { err = -ENOMEM ; goto out_free; }
@@ -662,7 +662,7 @@ out_no_change:/* (re)allocate space for new pointers to lower dentry */ size = new_branches *sizeof (struct unionfs_data ); new_data =krealloc (tmp_data, size,GFP_KERNEL ); -if (!new_data) { +if (unlikely (!new_data)) { err = -ENOMEM ; goto out_release; }
@@ -670,7 +670,7 @@ out_no_change:/* allocate space for new pointers to lower paths */ size = new_branches *sizeof (struct path ); new_lower_paths =krealloc (tmp_lower_paths, size,GFP_KERNEL ); -if (!new_lower_paths) { +if (unlikely (!new_lower_paths)) { err = -ENOMEM ; goto out_release; }
@@ -678,7 +678,7 @@ out_no_change:/* allocate space for new pointers to lower inodes */ new_lower_inodes =kcalloc (new_branches,sizeof (struct inode *),GFP_KERNEL ); -if (!new_lower_inodes) { +if (unlikely (!new_lower_inodes)) { err = -ENOMEM ; goto out_release; }
@@ -841,7 +841,7 @@ static struct inode *unionfs_alloc_inode(struct super_block *sb)struct unionfs_inode_info *i; i =kmem_cache_alloc (unionfs_inode_cachep,GFP_KERNEL ); -if (!i) +if (unlikely (!i))return NULL ;/* memset everything up to the inode to 0 */
@@ -872,7 +872,7 @@ int unionfs_init_inode_cache(void)kmem_cache_create ("unionfs_inode_cache" ,sizeof (struct unionfs_inode_info ),0 ,SLAB_RECLAIM_ACCOUNT , init_once); -if (!unionfs_inode_cachep) +if (unlikely (!unionfs_inode_cachep)) err = -ENOMEM ;return err; }
@@ -959,7 +959,7 @@ static int unionfs_show_options(struct seq_file *m, struct vfsmount *mnt)unionfs_lock_dentry (sb->s_root); tmp_page = (char *)__get_free_page (GFP_KERNEL ); -if (!tmp_page) { +if (unlikely (!tmp_page)) { ret = -ENOMEM ; goto out; }
fs/unionfs/unlink.c +2 -2
@@ -79,7 +79,7 @@ int unionfs_unlink(struct inode *dir, struct dentry *dentry)unionfs_read_lock (dentry->d_sb);unionfs_lock_dentry (dentry); -if (!__unionfs_d_revalidate_chain (dentry,NULL , false)) { +if (unlikely (!__unionfs_d_revalidate_chain (dentry,NULL , false))) { err = -ESTALE ; goto out; }
@@ -148,7 +148,7 @@ int unionfs_rmdir(struct inode *dir, struct dentry *dentry)unionfs_read_lock (dentry->d_sb);unionfs_lock_dentry (dentry); -if (!__unionfs_d_revalidate_chain (dentry,NULL , false)) { +if (unlikely (!__unionfs_d_revalidate_chain (dentry,NULL , false))) { err = -ESTALE ; goto out; }
fs/unionfs/xattr.c +5 -5
@@ -30,7 +30,7 @@ void *unionfs_xattr_alloc(size_t size, size_t limit)return NULL ; ptr =kmalloc (size,GFP_KERNEL ); -if (!ptr) +if (unlikely (!ptr))return ERR_PTR (-ENOMEM );return ptr; }
@@ -48,7 +48,7 @@ ssize_t unionfs_getxattr(struct dentry *dentry, const char *name, void *value,unionfs_read_lock (dentry->d_sb);unionfs_lock_dentry (dentry); -if (!__unionfs_d_revalidate_chain (dentry,NULL , false)) { +if (unlikely (!__unionfs_d_revalidate_chain (dentry,NULL , false))) { err = -ESTALE ; goto out; }
@@ -77,7 +77,7 @@ int unionfs_setxattr(struct dentry *dentry, const char *name,unionfs_read_lock (dentry->d_sb);unionfs_lock_dentry (dentry); -if (!__unionfs_d_revalidate_chain (dentry,NULL , false)) { +if (unlikely (!__unionfs_d_revalidate_chain (dentry,NULL , false))) { err = -ESTALE ; goto out; }
@@ -106,7 +106,7 @@ int unionfs_removexattr(struct dentry *dentry, const char *name)unionfs_read_lock (dentry->d_sb);unionfs_lock_dentry (dentry); -if (!__unionfs_d_revalidate_chain (dentry,NULL , false)) { +if (unlikely (!__unionfs_d_revalidate_chain (dentry,NULL , false))) { err = -ESTALE ; goto out; }
@@ -135,7 +135,7 @@ ssize_t unionfs_listxattr(struct dentry *dentry, char *list, size_t size)unionfs_read_lock (dentry->d_sb);unionfs_lock_dentry (dentry); -if (!__unionfs_d_revalidate_chain (dentry,NULL , false)) { +if (unlikely (!__unionfs_d_revalidate_chain (dentry,NULL , false))) { err = -ESTALE ; goto out; }
Signature · 1 line
1.5.2.2
PATCH 3/19 Unionfs: minor comment cleanups
In reply to Erez Zadok--- fs/unionfs/lookup.c | 2 +- fs/unionfs/mmap.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
fs/unionfs/lookup.c +1 -1
@@ -206,7 +206,7 @@ struct dentry *unionfs_lookup_backend(struct dentry *dentry, }if (wh_lower_dentry->d_inode) { -/* We found a whiteout so lets give up. */ +/* We found a whiteout so let's give up. */ if (S_ISREG (wh_lower_dentry->d_inode->i_mode)) {set_dbend (dentry, bindex);set_dbopaque (dentry, bindex);
fs/unionfs/mmap.c +1 -1
@@ -293,7 +293,7 @@ static int unionfs_commit_write(struct file *file, struct page *page, lower_file->f_pos = ((loff_t ) page->index <<PAGE_CACHE_SHIFT ) + from;/* -* SP: I use vfs_write instead of copying page data and the +* We use vfs_write instead of copying page data and the * prepare_write/commit_write combo because file system's like * GFS/OCFS2 don't like things touching those directly, * calling the underlying write op, while a little bit slower, will
Signature · 1 line
1.5.2.2
PATCH 4/19 Unionfs: use consistent printk prefixes
In reply to Erez Zadok--- fs/unionfs/inode.c | 4 ++-- fs/unionfs/union.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
fs/unionfs/inode.c +2 -2
@@ -90,7 +90,7 @@ static int unionfs_create(struct inode *parent, struct dentry *dentry,unlock_dir (lower_dir_dentry);if (err) { -printk ("unionfs_create: could not unlink " +printk ("unionfs: create: could not unlink " "whiteout, err = %d\n" , err); goto out; }
@@ -1088,7 +1088,7 @@ static int unionfs_setattr(struct dentry *dentry, struct iattr *ia)if (ia->ia_size !=i_size_read (inode)) { err =vmtruncate (inode, ia->ia_size);if (err) -printk ("unionfs_setattr: vmtruncate failed\n" ); +printk ("unionfs: setattr: vmtruncate failed\n" ); } }
fs/unionfs/union.h +2 -2
@@ -474,7 +474,7 @@ static inline struct vfsmount *unionfs_mntget(struct dentry *dentry, mnt =mntget (unionfs_lower_mnt_idx (dentry, bindex));#ifdef CONFIG_UNION_FS_DEBUG if (!mnt) -printk (KERN_DEBUG "unionfs_mntget: mnt=%p bindex=%d\n" , +printk (KERN_DEBUG "unionfs: mntget: mnt=%p bindex=%d\n" , mnt, bindex);#endif /* CONFIG_UNION_FS_DEBUG */
@@ -500,7 +500,7 @@ static inline void unionfs_mntput(struct dentry *dentry, int bindex)*/ if (!mnt && !(bindex >dbstart (dentry) && bindex <dbend (dentry)))printk (KERN_WARNING -"unionfs_mntput: mnt=%p bindex=%d\n" , +"unionfs: mntput: mnt=%p bindex=%d\n" , mnt, bindex);#endif /* CONFIG_UNION_FS_DEBUG */ mntput (mnt);
Signature · 1 line
1.5.2.2
PATCH 5/19 Unionfs: use UNIONFS_NAME macro
In reply to Erez Zadok--- fs/unionfs/debug.c | 2 +- fs/unionfs/main.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
fs/unionfs/debug.c +1 -1
@@ -428,7 +428,7 @@ void __unionfs_check_nd(const struct nameidata *nd, file = nd->intent.open.file;if (unlikely (file->f_path.dentry &&strcmp (file->f_dentry->d_sb->s_type->name, -"unionfs" ))) { +UNIONFS_NAME ))) {PRINT_CALLER (fname, fxn, line);printk (" CND1: lower_file of type %s\n" , file->f_path.dentry->d_sb->s_type->name);
fs/unionfs/main.c +2 -2
@@ -227,7 +227,7 @@ void unionfs_reinterpose(struct dentry *dentry)int check_branch (struct nameidata *nd) {/* XXX: remove in ODF code -- stacking unions allowed there */ -if (!strcmp (nd->dentry->d_sb->s_type->name,"unionfs" )) +if (!strcmp (nd->dentry->d_sb->s_type->name,UNIONFS_NAME ))return -EINVAL ;if (!nd->dentry->d_inode)return -ENOENT ;
@@ -722,7 +722,7 @@ static int unionfs_get_sb(struct file_system_type *fs_type,static struct file_system_type unionfs_fs_type = { .owner =THIS_MODULE , - .name ="unionfs" , + .name =UNIONFS_NAME , .get_sb = unionfs_get_sb, .kill_sb = generic_shutdown_super, .fs_flags =FS_REVAL_DOT ,
Signature · 1 line
1.5.2.2
PATCH 6/19 Unionfs: properly indent static struct
In reply to Erez Zadok--- fs/unionfs/main.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
fs/unionfs/main.c +4 -1
@@ -564,7 +564,10 @@ static struct dentry *unionfs_d_alloc_root(struct super_block *sb)struct dentry *ret =NULL ;if (sb) { -static const struct qstr name = {.name ="/" ,.len =1 }; +static const struct qstr name = { + .name ="/" , + .len =1 + }; ret =d_alloc (NULL , &name);if (likely (ret)) {
Signature · 1 line
1.5.2.2
PATCH 7/19 Unionfs: remove unnecessary if condition
In reply to Erez ZadokThe condition is always true there.
--- fs/unionfs/dirfops.c | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-)
fs/unionfs/dirfops.c +4 -6
@@ -63,12 +63,10 @@ static int unionfs_filldir(void *dirent, const char *name, int namelen,off_t pos =rdstate2offset (buf->rdstate);u64 unionfs_ino = ino; -if (!err) { - err = buf->filldir (buf->dirent, name, namelen, pos, - unionfs_ino, d_type); - buf->rdstate->offset++; -verify_rdstate_offset (buf->rdstate); - } + err = buf->filldir (buf->dirent, name, namelen, pos, + unionfs_ino, d_type); + buf->rdstate->offset++; +verify_rdstate_offset (buf->rdstate); }/* * If we did fill it, stuff it in our hash, otherwise return an
Signature · 1 line
1.5.2.2
PATCH 8/19 Unionfs: use page_offset() helper
In reply to Erez Zadok--- fs/unionfs/mmap.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-)
fs/unionfs/mmap.c +3 -4
@@ -179,8 +179,7 @@ static int unionfs_do_readpage(struct file *file, struct page *page)* may be a little slower, but a lot safer, as the VFS does a lot of * the necessary magic for us. */ - offset = lower_file->f_pos = - ((loff_t ) page->index <<PAGE_CACHE_SHIFT ); + offset = lower_file->f_pos =page_offset (page); old_fs =get_fs ();set_fs (KERNEL_DS ); err = vfs_read(lower_file, page_data, PAGE_CACHE_SIZE,
@@ -290,7 +289,7 @@ static int unionfs_commit_write(struct file *file, struct page *page,BUG_ON (lower_file ==NULL ); page_data = (char *)kmap (page); - lower_file->f_pos = ((loff_t ) page->index <<PAGE_CACHE_SHIFT ) + from; + lower_file->f_pos =page_offset (page) + from;/* * We use vfs_write instead of copying page data and the
@@ -312,7 +311,7 @@ static int unionfs_commit_write(struct file *file, struct page *page, inode->i_blocks = lower_inode->i_blocks;/* we may have to update i_size */ - pos = ((loff_t ) page->index <<PAGE_CACHE_SHIFT ) + to; + pos =page_offset (page) + to;if (pos >i_size_read (inode))i_size_write (inode, pos);/* if vfs_write succeeded above, sync up our times */
Signature · 1 line
1.5.2.2
PATCH 9/19 Unionfs: use pr_debug() instead of custom dprintk()
In reply to Erez ZadokAlso turn on DEBUG if CONFIG_UNION_FS_DEBUG is on
--- fs/unionfs/Makefile | 4 ++++ fs/unionfs/commonfops.c | 4 ++-- fs/unionfs/dentry.c | 6 +++--- fs/unionfs/lookup.c | 2 +- fs/unionfs/union.h | 6 +----- 5 files changed, 11 insertions(+), 11 deletions(-)
fs/unionfs/Makefile +4 -0
@@ -7,3 +7,7 @@ unionfs-y := subr.o dentry.o file.o inode.o main.o super.o \ unionfs-$(CONFIG_UNION_FS_XATTR) += xattr.o unionfs-$(CONFIG_UNION_FS_DEBUG) += debug.o + +ifeq ($(CONFIG_UNION_FS_DEBUG),y) +EXTRA_CFLAGS += -DDEBUG +endif
fs/unionfs/commonfops.c +2 -2
@@ -394,8 +394,8 @@ int unionfs_file_revalidate(struct file *file, bool willwrite)if (willwrite &&IS_WRITE_FLAG (file->f_flags) && !IS_WRITE_FLAG (unionfs_lower_file (file)->f_flags) &&is_robranch (dentry)) { -dprintk (KERN_DEBUG "unionfs: do delay copyup of \"%s\"\n" , - dentry->d_name.name); +pr_debug ("unionfs: do delay copyup of \"%s\"\n" , + dentry->d_name.name); err =do_delayed_copyup (file); }
fs/unionfs/dentry.c +3 -3
@@ -46,9 +46,9 @@ static bool __unionfs_d_revalidate_one(struct dentry *dentry,/* if the dentry is unhashed, do NOT revalidate */ if (d_deleted (dentry)) { -dprintk (KERN_DEBUG "unionfs: unhashed dentry being " -"revalidated: %*s\n" , - dentry->d_name.len, dentry->d_name.name); +pr_debug ("unionfs: unhashed dentry being " +"revalidated: %*s\n" , + dentry->d_name.len, dentry->d_name.name); goto out; }
fs/unionfs/lookup.c +1 -1
@@ -629,7 +629,7 @@ int init_lower_nd(struct nameidata *nd, unsigned int flags)* We should never get here, for now. * We can add new cases here later on. */ -dprintk ("unionfs: unknown nameidata flag 0x%x\n" , flags); +pr_debug ("unionfs: unknown nameidata flag 0x%x\n" , flags);BUG ();break ; }
fs/unionfs/union.h +1 -5
@@ -508,10 +508,8 @@ static inline void unionfs_mntput(struct dentry *dentry, int bindex)#ifdef CONFIG_UNION_FS_DEBUG -#define dprintk(args...) printk(args) -/* useful for tracking code reachability */ -#define UDBG printk("DBG:%s:%s:%d\n",__FILE__,__FUNCTION__,__LINE__) +#define UDBG pr_debug("DBG:%s:%s:%d\n",__FILE__,__FUNCTION__,__LINE__)#define unionfs_check_inode (i) __unionfs_check_inode((i), \ __FILE__,__FUNCTION__,__LINE__)
@@ -550,8 +548,6 @@ extern void __show_inode_counts(const struct inode *inode,#else /* not CONFIG_UNION_FS_DEBUG */ -#define dprintk(args...) do { } while (0) -/* we leave useful hooks for these check functions throughout the code */ #define unionfs_check_inode (i) do { } while(0)#define unionfs_check_dentry (d) do { } while(0)
Signature · 1 line
1.5.2.2
PATCH 10/19 Unionfs: convert all appropriate printk's to pr_debug calls
In reply to Erez Zadok--- fs/unionfs/commonfops.c | 14 ++-- fs/unionfs/debug.c | 248 +++++++++++++++++++++++----------------------- fs/unionfs/union.h | 8 +- 3 files changed, 134 insertions(+), 136 deletions(-)
fs/unionfs/commonfops.c +7 -7
@@ -59,8 +59,8 @@ retry: counter++;sprintf (suffix,"%*.*x" , countersize, countersize, counter); -printk (KERN_DEBUG "unionfs: trying to rename %s to %s\n" , - dentry->d_name.name, name); +pr_debug ("unionfs: trying to rename %s to %s\n" , + dentry->d_name.name, name); tmp_dentry =lookup_one_len (name, lower_dentry->d_parent, nlen);
@@ -637,11 +637,11 @@ int unionfs_file_release(struct inode *inode, struct file *file)if (fileinfo->rdstate) { fileinfo->rdstate->access = jiffies; -printk (KERN_DEBUG "unionfs: saving rdstate with cookie " -"%u [%d.%lld]\n" , - fileinfo->rdstate->cookie, - fileinfo->rdstate->bindex, - (long long )fileinfo->rdstate->dirpos); +pr_debug ("unionfs: saving rdstate with cookie " +"%u [%d.%lld]\n" , + fileinfo->rdstate->cookie, + fileinfo->rdstate->bindex, + (long long )fileinfo->rdstate->dirpos);spin_lock (&inodeinfo->rdlock); inodeinfo->rdcount++; list_add_tail(&fileinfo->rdstate->cache,
fs/unionfs/debug.c +124 -124
443 lines not on this page · raw message
fs/unionfs/union.h +3 -5
@@ -474,8 +474,8 @@ static inline struct vfsmount *unionfs_mntget(struct dentry *dentry, mnt =mntget (unionfs_lower_mnt_idx (dentry, bindex));#ifdef CONFIG_UNION_FS_DEBUG if (!mnt) -printk (KERN_DEBUG "unionfs: mntget: mnt=%p bindex=%d\n" , - mnt, bindex); +pr_debug ("unionfs: mntget: mnt=%p bindex=%d\n" , + mnt, bindex);#endif /* CONFIG_UNION_FS_DEBUG */ return mnt;
@@ -499,9 +499,7 @@ static inline void unionfs_mntput(struct dentry *dentry, int bindex)* been a regular file: it had to have been a directory. */ if (!mnt && !(bindex >dbstart (dentry) && bindex <dbend (dentry))) -printk (KERN_WARNING -"unionfs: mntput: mnt=%p bindex=%d\n" , - mnt, bindex); +pr_debug ("unionfs: mntput: mnt=%p bindex=%d\n" , mnt, bindex);#endif /* CONFIG_UNION_FS_DEBUG */ mntput (mnt); }
Signature · 1 line
1.5.2.2
PATCH 11/19 Unionfs: add missing newlines in printk's
In reply to Erez Zadok--- fs/unionfs/main.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
fs/unionfs/main.c +1 -1
@@ -175,7 +175,7 @@ skip:/* Do nothing. */ break ;default : -printk (KERN_ERR "unionfs: invalid interpose flag passed!" ); +printk (KERN_ERR "unionfs: invalid interpose flag passed!\n" );BUG (); } goto out;
Signature · 1 line
1.5.2.2
PATCH 12/19 Unionfs: update/assign a KERN_* level to all printk statements
In reply to Erez ZadokAlso use pr_info() instead of printk(KERN_INFO ...)
--- fs/unionfs/commonfops.c | 4 ++-- fs/unionfs/copyup.c | 2 +- fs/unionfs/dentry.c | 18 +++++++++--------- fs/unionfs/file.c | 7 ++++--- fs/unionfs/inode.c | 16 +++++++++------- fs/unionfs/lookup.c | 2 +- fs/unionfs/main.c | 33 +++++++++++++++++---------------- fs/unionfs/mmap.c | 2 +- fs/unionfs/rdstate.c | 2 +- fs/unionfs/rename.c | 14 +++++++------- fs/unionfs/subr.c | 2 +- fs/unionfs/super.c | 45 ++++++++++++++++++++++++--------------------- 12 files changed, 77 insertions(+), 70 deletions(-)
fs/unionfs/commonfops.c +2 -2
@@ -760,8 +760,8 @@ long unionfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg)switch (cmd) {case UNIONFS_IOCTL_INCGEN :/* Increment the superblock generation count */ -printk ("unionfs: incgen ioctl deprecated; " -"use \"-o remount,incgen\"\n" ); +pr_info ("unionfs: incgen ioctl deprecated; " +"use \"-o remount,incgen\"\n" ); err = -ENOSYS ;break ;
fs/unionfs/copyup.c +1 -1
@@ -209,7 +209,7 @@ static int __copyup_ndentry(struct dentry *old_lower_dentry, err = args.err;release_lower_nd (&nd, err); }else { -printk (KERN_ERR "unionfs: unknown inode type %d\n" , +printk (KERN_CRIT "unionfs: unknown inode type %d\n" , old_mode);BUG (); }
fs/unionfs/dentry.c +9 -9
@@ -218,17 +218,17 @@ bool is_newer_lower(const struct dentry *dentry)*/ if (unlikely (timespec_compare (&inode->i_mtime, &lower_inode->i_mtime) <0 )) { -printk ("unionfs: new lower inode mtime " -"(bindex=%d, name=%s)\n" , bindex, - dentry->d_name.name); +pr_info ("unionfs: new lower inode mtime " +"(bindex=%d, name=%s)\n" , bindex, + dentry->d_name.name);show_dinode_times (dentry);return true;/* mtime changed! */ }if (unlikely (timespec_compare (&inode->i_ctime, &lower_inode->i_ctime) <0 )) { -printk ("unionfs: new lower inode ctime " -"(bindex=%d, name=%s)\n" , bindex, - dentry->d_name.name); +pr_info ("unionfs: new lower inode ctime " +"(bindex=%d, name=%s)\n" , bindex, + dentry->d_name.name);show_dinode_times (dentry);return true;/* ctime changed! */ }
@@ -328,7 +328,7 @@ bool __unionfs_d_revalidate_chain(struct dentry *dentry, struct nameidata *nd,*/ chain =kzalloc (chain_len *sizeof (struct dentry *),GFP_KERNEL );if (unlikely (!chain)) { -printk ("unionfs: no more memory in %s\n" , __FUNCTION__); +printk (KERN_CRIT "unionfs: no more memory in %s\n" , __FUNCTION__); goto out; }
@@ -449,12 +449,12 @@ static void unionfs_d_release(struct dentry *dentry)unionfs_check_dentry (dentry);/* this could be a negative dentry, so check first */ if (unlikely (!UNIONFS_D (dentry))) { -printk (KERN_DEBUG "unionfs: dentry without private data: %.*s\n" , +printk (KERN_ERR "unionfs: dentry without private data: %.*s\n" , dentry->d_name.len, dentry->d_name.name); goto out; }else if (dbstart (dentry) <0 ) {/* this is due to a failed lookup */ -printk (KERN_DEBUG "unionfs: dentry without lower " +printk (KERN_ERR "unionfs: dentry without lower " "dentries: %.*s\n" , dentry->d_name.len, dentry->d_name.name); goto out_free;
fs/unionfs/file.c +4 -3
@@ -121,12 +121,13 @@ static int unionfs_mmap(struct file *file, struct vm_area_struct *vma) lower_file =unionfs_lower_file (file);if (willwrite && !lower_file->f_mapping->a_ops->writepage) { err = -EINVAL ; -printk ("unionfs: branch %d file system does not support " -"writeable mmap\n" ,fbstart (file)); +printk (KERN_ERR "unionfs: branch %d file system does not " +"support writeable mmap\n" ,fbstart (file)); }else { err =generic_file_mmap (file, vma);if (err) -printk ("unionfs: generic_file_mmap failed %d\n" , err); +printk (KERN_ERR +"unionfs: generic_file_mmap failed %d\n" , err); } out:
fs/unionfs/inode.c +9 -7
@@ -90,8 +90,8 @@ static int unionfs_create(struct inode *parent, struct dentry *dentry,unlock_dir (lower_dir_dentry);if (err) { -printk ("unionfs: create: could not unlink " -"whiteout, err = %d\n" , err); +printk (KERN_ERR "unionfs: create: could not " +"unlink whiteout, err = %d\n" , err); goto out; } }
@@ -446,7 +446,7 @@ static int unionfs_symlink(struct inode *dir, struct dentry *dentry,if (IS_ERR (lower_dentry)) err =PTR_ERR (lower_dentry); -printk (KERN_DEBUG "unionfs: lower dentry " +printk (KERN_ERR "unionfs: lower dentry " "NULL (or error) for bindex = %d\n" , bindex);continue ;
@@ -588,7 +588,7 @@ static int unionfs_mkdir(struct inode *parent, struct dentry *dentry, int mode) dentry->d_name.name, bindex);if (!lower_dentry ||IS_ERR (lower_dentry)) { -printk (KERN_DEBUG "unionfs: lower dentry " +printk (KERN_ERR "unionfs: lower dentry " " NULL for bindex = %d\n" , bindex);continue ; }
@@ -732,7 +732,7 @@ static int unionfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dentry->d_name.name, bindex);if (IS_ERR (lower_dentry)) { -printk (KERN_DEBUG "unionfs: failed to create " +printk (KERN_ERR "unionfs: failed to create " "parents on %d, err = %ld\n" , bindex,PTR_ERR (lower_dentry));continue ;
@@ -878,7 +878,8 @@ static void unionfs_put_link(struct dentry *dentry, struct nameidata *nd,unionfs_lock_dentry (dentry);if (unlikely (!__unionfs_d_revalidate_chain (dentry, nd, false))) -printk ("unionfs: put_link failed to revalidate dentry\n" ); +printk (KERN_ERR +"unionfs: put_link failed to revalidate dentry\n" );unionfs_unlock_dentry (dentry);unionfs_check_dentry (dentry);
@@ -1088,7 +1089,8 @@ static int unionfs_setattr(struct dentry *dentry, struct iattr *ia)if (ia->ia_size !=i_size_read (inode)) { err =vmtruncate (inode, ia->ia_size);if (err) -printk ("unionfs: setattr: vmtruncate failed\n" ); +printk (KERN_ERR +"unionfs: setattr: vmtruncate failed\n" ); } }
fs/unionfs/lookup.c +1 -1
@@ -214,7 +214,7 @@ struct dentry *unionfs_lookup_backend(struct dentry *dentry,break ; } err = -EIO ; -printk (KERN_NOTICE "unionfs: EIO: invalid whiteout " +printk (KERN_ERR "unionfs: EIO: invalid whiteout " "entry type %d.\n" , wh_lower_dentry->d_inode->i_mode);dput (wh_lower_dentry);
fs/unionfs/main.c +17 -16
@@ -175,7 +175,7 @@ skip:/* Do nothing. */ break ;default : -printk (KERN_ERR "unionfs: invalid interpose flag passed!\n" ); +printk (KERN_CRIT "unionfs: invalid interpose flag passed!\n" );BUG (); } goto out;
@@ -303,7 +303,7 @@ static int parse_dirs_option(struct super_block *sb, struct unionfs_dentry_infostruct dentry *dent2;if (options[0 ] =='\0' ) { -printk (KERN_WARNING "unionfs: no branches specified\n" ); +printk (KERN_ERR "unionfs: no branches specified\n" ); err = -EINVAL ; goto out; }
@@ -358,14 +358,14 @@ static int parse_dirs_option(struct super_block *sb, struct unionfs_dentry_info err =path_lookup (name,LOOKUP_FOLLOW , &nd);if (err) { -printk (KERN_WARNING "unionfs: error accessing " +printk (KERN_ERR "unionfs: error accessing " "lower directory '%s' (error %d)\n" , name, err); goto out; }if ((err =check_branch (&nd))) { -printk (KERN_WARNING "unionfs: lower directory " +printk (KERN_ERR "unionfs: lower directory " "'%s' is not a valid branch\n" , name);path_release (&nd); goto out;
@@ -385,7 +385,7 @@ static int parse_dirs_option(struct super_block *sb, struct unionfs_dentry_info }if (branches ==0 ) { -printk (KERN_WARNING "unionfs: no branches specified\n" ); +printk (KERN_ERR "unionfs: no branches specified\n" ); err = -EINVAL ; goto out; }
@@ -412,7 +412,7 @@ static int parse_dirs_option(struct super_block *sb, struct unionfs_dentry_infofor (j = i +1 ; j < branches; j++) { dent2 = lower_root_info->lower_paths[j].dentry;if (is_branch_overlap (dent1, dent2)) { -printk (KERN_WARNING "unionfs: branches %d and " +printk (KERN_ERR "unionfs: branches %d and " "%d overlap\n" , i, j); err = -EINVAL ; goto out;
@@ -485,14 +485,15 @@ static struct unionfs_dentry_info *unionfs_parse_options(* don't, above this check. */ if (!optarg) { -printk ("unionfs: %s requires an argument.\n" , optname); +printk (KERN_ERR "unionfs: %s requires an argument.\n" , + optname); err = -EINVAL ; goto out_error; }if (!strcmp ("dirs" , optname)) {if (++dirsfound >1 ) { -printk (KERN_WARNING +printk (KERN_ERR "unionfs: multiple dirs specified\n" ); err = -EINVAL ; goto out_error;
@@ -506,7 +507,7 @@ static struct unionfs_dentry_info *unionfs_parse_options(/* All of these options require an integer argument. */ intval =simple_strtoul (optarg, &endptr,0 );if (*endptr) { -printk (KERN_WARNING +printk (KERN_ERR "unionfs: invalid %s option '%s'\n" , optname, optarg); err = -EINVAL ;
@@ -514,12 +515,12 @@ static struct unionfs_dentry_info *unionfs_parse_options( } err = -EINVAL ; -printk (KERN_WARNING +printk (KERN_ERR "unionfs: unrecognized option '%s'\n" , optname); goto out_error; }if (dirsfound !=1 ) { -printk (KERN_WARNING "unionfs: dirs option required\n" ); +printk (KERN_ERR "unionfs: dirs option required\n" ); err = -EINVAL ; goto out_error; }
@@ -591,7 +592,7 @@ static int unionfs_read_super(struct super_block *sb, void *raw_data,int bindex, bstart, bend;if (!raw_data) { -printk (KERN_WARNING +printk (KERN_ERR "unionfs: read_super: missing data argument\n" ); err = -EINVAL ; goto out;
@@ -600,7 +601,7 @@ static int unionfs_read_super(struct super_block *sb, void *raw_data,/* Allocate superblock private data */ sb->s_fs_info =kzalloc (sizeof (struct unionfs_sb_info ),GFP_KERNEL );if (unlikely (!UNIONFS_SB (sb))) { -printk (KERN_WARNING "unionfs: read_super: out of memory\n" ); +printk (KERN_CRIT "unionfs: read_super: out of memory\n" ); err = -ENOMEM ; goto out; }
@@ -612,7 +613,7 @@ static int unionfs_read_super(struct super_block *sb, void *raw_data, lower_root_info =unionfs_parse_options (sb, raw_data);if (IS_ERR (lower_root_info)) { -printk (KERN_WARNING +printk (KERN_ERR "unionfs: read_super: error while parsing options " "(err = %ld)\n" ,PTR_ERR (lower_root_info)); err =PTR_ERR (lower_root_info);
@@ -735,7 +736,7 @@ static int __init init_unionfs_fs(void) {int err; -printk ("Registering unionfs " UNIONFS_VERSION "\n" ); +pr_info ("Registering unionfs " UNIONFS_VERSION "\n" );if (unlikely ((err =unionfs_init_filldir_cache ()))) goto out;
@@ -763,7 +764,7 @@ static void __exit exit_unionfs_fs(void)unionfs_destroy_inode_cache ();unionfs_destroy_dentry_cache ();unregister_filesystem (&unionfs_fs_type); -printk ("Completed unionfs module unload.\n" ); +pr_info ("Completed unionfs module unload\n" ); } MODULE_AUTHOR("Erez Zadok, Filesystems and Storage Lab, Stony Brook University"
fs/unionfs/mmap.c +1 -1
@@ -347,7 +347,7 @@ static void unionfs_sync_page(struct page *page)*/ lower_page =find_lock_page (lower_inode->i_mapping, page->index);if (!lower_page) { -printk (KERN_DEBUG "unionfs: find_lock_page failed\n" ); +printk (KERN_ERR "unionfs: find_lock_page failed\n" ); goto out; }
fs/unionfs/rdstate.c +1 -1
@@ -218,7 +218,7 @@ struct filldir_node *find_filldir_node(struct unionfs_dir_state *rdstate,* system is corrupted. */ if (unlikely (cursor->bindex == rdstate->bindex)) { -printk (KERN_DEBUG "unionfs: filldir: possible " +printk (KERN_ERR "unionfs: filldir: possible " "I/O error: a file is duplicated " "in the same branch %d: %s\n" , rdstate->bindex, cursor->name);
fs/unionfs/rename.c +7 -7
@@ -40,7 +40,7 @@ static int __unionfs_rename(struct inode *old_dir, struct dentry *old_dentry, new_dentry, new_dentry->d_name.name, bindex);if (IS_ERR (lower_new_dentry)) { -printk (KERN_DEBUG "unionfs: error creating directory " +printk (KERN_ERR "unionfs: error creating directory " "tree for rename, bindex = %d, err = %ld\n" , bindex,PTR_ERR (lower_new_dentry)); err =PTR_ERR (lower_new_dentry);
@@ -66,7 +66,7 @@ static int __unionfs_rename(struct inode *old_dir, struct dentry *old_dentry,if (lower_wh_dentry->d_inode) {/* get rid of the whiteout that is existing */ if (lower_new_dentry->d_inode) { -printk (KERN_WARNING "unionfs: both a whiteout and a " +printk (KERN_ERR "unionfs: both a whiteout and a " "dentry exist when doing a rename!\n" ); err = -EIO ;
@@ -293,14 +293,14 @@ revert:/* Do revert here. */ local_err =unionfs_refresh_lower_dentry (new_dentry, old_bstart);if (local_err) { -printk (KERN_WARNING "unionfs: revert failed in rename: " +printk (KERN_ERR "unionfs: revert failed in rename: " "the new refresh failed.\n" ); eio = -EIO ; } local_err =unionfs_refresh_lower_dentry (old_dentry, old_bstart);if (local_err) { -printk (KERN_WARNING "unionfs: revert failed in rename: " +printk (KERN_ERR "unionfs: revert failed in rename: " "the old refresh failed.\n" ); eio = -EIO ; goto revert_out;
@@ -308,7 +308,7 @@ revert:if (!unionfs_lower_dentry_idx (new_dentry, bindex) || !unionfs_lower_dentry_idx (new_dentry, bindex)->d_inode) { -printk (KERN_WARNING "unionfs: revert failed in rename: " +printk (KERN_ERR "unionfs: revert failed in rename: " "the object disappeared from under us!\n" ); eio = -EIO ; goto revert_out;
@@ -316,7 +316,7 @@ revert:if (unionfs_lower_dentry_idx (old_dentry, bindex) &&unionfs_lower_dentry_idx (old_dentry, bindex)->d_inode) { -printk (KERN_WARNING "unionfs: revert failed in rename: " +printk (KERN_ERR "unionfs: revert failed in rename: " "the object was created underneath us!\n" ); eio = -EIO ; goto revert_out;
@@ -327,7 +327,7 @@ revert:/* If we can't fix it, then we cop-out with -EIO. */ if (local_err) { -printk (KERN_WARNING "unionfs: revert failed in rename!\n" ); +printk (KERN_ERR "unionfs: revert failed in rename!\n" ); eio = -EIO ; }
fs/unionfs/subr.c +1 -1
@@ -61,7 +61,7 @@ int create_whiteout(struct dentry *dentry, int start) dentry->d_name.name, bindex);if (!lower_dentry ||IS_ERR (lower_dentry)) { -printk (KERN_DEBUG "unionfs: create_parents " +printk (KERN_ERR "unionfs: create_parents " "failed for bindex = %d\n" , bindex);continue ; }
fs/unionfs/super.c +24 -21
166 lines not on this page · raw message
Signature · 1 line
1.5.2.2
PATCH 13/19 Unionfs: remove periods from the end of printk strings
In reply to Erez Zadok--- fs/unionfs/lookup.c | 2 +- fs/unionfs/main.c | 2 +- fs/unionfs/rename.c | 4 ++-- fs/unionfs/super.c | 10 +++++----- 4 files changed, 9 insertions(+), 9 deletions(-)
fs/unionfs/lookup.c +1 -1
@@ -215,7 +215,7 @@ struct dentry *unionfs_lookup_backend(struct dentry *dentry, } err = -EIO ;printk (KERN_ERR "unionfs: EIO: invalid whiteout " -"entry type %d.\n" , +"entry type %d\n" , wh_lower_dentry->d_inode->i_mode);dput (wh_lower_dentry);dput (first_lower_dentry);
fs/unionfs/main.c +1 -1
@@ -485,7 +485,7 @@ static struct unionfs_dentry_info *unionfs_parse_options(* don't, above this check. */ if (!optarg) { -printk (KERN_ERR "unionfs: %s requires an argument.\n" , +printk (KERN_ERR "unionfs: %s requires an argument\n" , optname); err = -EINVAL ; goto out_error;
fs/unionfs/rename.c +2 -2
@@ -294,14 +294,14 @@ revert: local_err =unionfs_refresh_lower_dentry (new_dentry, old_bstart);if (local_err) {printk (KERN_ERR "unionfs: revert failed in rename: " -"the new refresh failed.\n" ); +"the new refresh failed\n" ); eio = -EIO ; } local_err =unionfs_refresh_lower_dentry (old_dentry, old_bstart);if (local_err) {printk (KERN_ERR "unionfs: revert failed in rename: " -"the old refresh failed.\n" ); +"the old refresh failed\n" ); eio = -EIO ; goto revert_out; }
fs/unionfs/super.c +5 -5
@@ -173,18 +173,18 @@ static noinline int do_remount_mode_option(char *optarg, int cur_branches,/* by now, optarg contains the branch name */ if (!*optarg) {printk (KERN_ERR -"unionfs: no branch specified for mode change.\n" ); +"unionfs: no branch specified for mode change\n" ); goto out; }if (!modename) { -printk (KERN_ERR "unionfs: branch \"%s\" requires a mode.\n" , +printk (KERN_ERR "unionfs: branch \"%s\" requires a mode\n" , optarg); goto out; } *modename++ ='\0' ; perms =__parse_branch_mode (modename);if (perms ==0 ) { -printk (KERN_ERR "unionfs: invalid mode \"%s\" for \"%s\".\n" , +printk (KERN_ERR "unionfs: invalid mode \"%s\" for \"%s\"\n" , modename, optarg); goto out; }
@@ -584,7 +584,7 @@ static int unionfs_remount_fs(struct super_block *sb, int *flags,*/ if (!optarg || !*optarg) {printk (KERN_ERR "unionfs: all remount options require " -"an argument (%s).\n" , optname); +"an argument (%s)\n" , optname); err = -EINVAL ; goto out_release; }
@@ -634,7 +634,7 @@ static int unionfs_remount_fs(struct super_block *sb, int *flags,*/ if (!strcmp ("dirs" , optname)) {printk (KERN_WARNING -"unionfs: remount ignoring option \"%s\".\n" , +"unionfs: remount ignoring option \"%s\"\n" , optname);continue ; }
Signature · 1 line
1.5.2.2
PATCH 14/19 Unionfs: use braces in both branches of conditionals
In reply to Erez ZadokAs per CodingStyle, if one branch of an if-then-else has braces because it has multiple statements, then the other branch should have braces too, even if the other branch has only one statement in it.
--- fs/unionfs/commonfops.c | 6 ++++-- fs/unionfs/dentry.c | 8 ++++---- fs/unionfs/dirfops.c | 6 ++++-- fs/unionfs/dirhelper.c | 4 ++-- fs/unionfs/inode.c | 6 ++++-- fs/unionfs/lookup.c | 7 ++++--- fs/unionfs/main.c | 4 ++-- fs/unionfs/rdstate.c | 4 ++-- fs/unionfs/rename.c | 21 ++++++++++++--------- fs/unionfs/unlink.c | 9 +++++---- 10 files changed, 43 insertions(+), 32 deletions(-)
fs/unionfs/commonfops.c +4 -2
@@ -182,8 +182,9 @@ static int open_all_files(struct file *file)if (IS_ERR (lower_file)) { err =PTR_ERR (lower_file); goto out; - }else + }else {unionfs_set_lower_file_idx (file, bindex, lower_file); + } } out:return err;
@@ -484,8 +485,9 @@ static int __open_file(struct inode *inode, struct file *file)break ; }return err; - }else + }else { lower_flags &= ~(OPEN_WRITE_FLAGS ); + } }dget (lower_dentry);
fs/unionfs/dentry.c +4 -4
@@ -299,9 +299,9 @@ bool __unionfs_d_revalidate_chain(struct dentry *dentry, struct nameidata *nd,* always be valid, but its lower inode times don't have to * be, so sync up the times only. */ -if (IS_ROOT (dtmp)) +if (IS_ROOT (dtmp)) {unionfs_copy_attr_times (dtmp->d_inode); -else { + }else {/* * reset generation number to zero, guaranteed to be * "old"
@@ -376,9 +376,9 @@ out_this:if (unlikely (is_newer_lower (dentry))) {/* root dentry special case as aforementioned */ -if (IS_ROOT (dentry)) +if (IS_ROOT (dentry)) {unionfs_copy_attr_times (dentry->d_inode); -else { + }else {/* * reset generation number to zero, guaranteed to be * "old"
fs/unionfs/dirfops.c +4 -2
@@ -174,8 +174,9 @@ static int unionfs_readdir(struct file *file, void *dirent, filldir_t filldir)free_rdstate (uds);UNIONFS_F (file)->rdstate =NULL ; file->f_pos =DIREOF ; - }else + }else { file->f_pos =rdstate2offset (uds); + } out:unionfs_read_unlock (file->f_path.dentry->d_sb);
@@ -242,8 +243,9 @@ static loff_t unionfs_dir_llseek(struct file *file, loff_t offset, int origin)if (rdstate) {UNIONFS_F (file)->rdstate = rdstate; err = rdstate->offset; - }else + }else { err = -EINVAL ; + } }break ;case SEEK_CUR :
fs/unionfs/dirhelper.c +2 -2
@@ -111,9 +111,9 @@ int delete_whiteouts(struct dentry *dentry, int bindex,BUG_ON (!S_ISDIR (lower_dir->i_mode));mutex_lock (&lower_dir->i_mutex); -if (!permission (lower_dir,MAY_WRITE |MAY_EXEC ,NULL )) +if (!permission (lower_dir,MAY_WRITE |MAY_EXEC ,NULL )) { err =do_delete_whiteouts (dentry, bindex, namelist); -else { + }else { args.deletewh.namelist = namelist; args.deletewh.dentry = dentry; args.deletewh.bindex = bindex;
fs/unionfs/inode.c +4 -2
@@ -571,8 +571,9 @@ static int unionfs_mkdir(struct inode *parent, struct dentry *dentry, int mode)if (!IS_COPYUP_ERR (err)) goto out; bstart--; - }else + }else { whiteout_unlinked =1 ; + } }for (bindex = bstart; bindex >=0 ; bindex--) {
@@ -718,8 +719,9 @@ static int unionfs_mknod(struct inode *dir, struct dentry *dentry, int mode,if (!IS_COPYUP_ERR (err)) goto out; bstart--; - }else + }else { whiteout_unlinked =1 ; + } }for (bindex = bstart; bindex >=0 ; bindex--) {
fs/unionfs/lookup.c +4 -3
@@ -47,11 +47,11 @@ static noinline int is_opaque_dir(struct dentry *dentry, int bindex)mutex_lock (&lower_inode->i_mutex); -if (!permission (lower_inode,MAY_EXEC ,NULL )) +if (!permission (lower_inode,MAY_EXEC ,NULL )) { wh_lower_dentry =lookup_one_len (UNIONFS_DIR_OPAQUE , lower_dentry,sizeof (UNIONFS_DIR_OPAQUE ) -1 ); -else { + }else { args.is_opaque.dentry = lower_dentry;run_sioq (__is_opaque_dir, &args); wh_lower_dentry = args.ret;
@@ -250,8 +250,9 @@ struct dentry *unionfs_lookup_backend(struct dentry *dentry, first_lower_mnt =unionfs_mntget (parent_dentry, bindex); first_dentry_offset = bindex; - }else + }else {dput (lower_dentry); + }continue ; }
fs/unionfs/main.c +2 -2
@@ -149,9 +149,9 @@ skip:break ;case INTERPOSE_LOOKUP : spliced =d_splice_alias (inode, dentry); -if (IS_ERR (spliced)) +if (IS_ERR (spliced)) { err =PTR_ERR (spliced); -else if (spliced && spliced != dentry) { + }else if (spliced && spliced != dentry) {/* * d_splice can return a dentry if it was * disconnected and had to be moved. We must ensure
fs/unionfs/rdstate.c +2 -2
@@ -260,9 +260,9 @@ int add_filldir_node(struct unionfs_dir_state *rdstate, const char *name, new->bindex = bindex; new->whiteout = whiteout; -if (namelen <DNAME_INLINE_LEN_MIN ) +if (namelen <DNAME_INLINE_LEN_MIN ) { new->name = new->iname; -else { + }else { new->name =kmalloc (namelen +1 ,GFP_KERNEL );if (unlikely (!new->name)) {kmem_cache_free (unionfs_filldir_cachep, new);
fs/unionfs/rename.c +12 -9
@@ -83,8 +83,9 @@ static int __unionfs_rename(struct inode *old_dir, struct dentry *old_dentry,unlock_dir (lower_wh_dir_dentry);if (err) goto out; - }else + }else {dput (lower_wh_dentry); + }dget (lower_old_dentry); lower_old_dir_dentry =dget_parent (lower_old_dentry);
@@ -178,8 +179,9 @@ static int do_unionfs_rename(struct inode *old_dir,if (!IS_COPYUP_ERR (err)) goto out; do_copyup = old_bstart -1 ; - }else + }else { revert =1 ; + }/* * Unlink all instances of destination that exist to the left of
@@ -271,9 +273,9 @@ static int do_unionfs_rename(struct inode *old_dir, local_err =vfs_create (lower_parent->d_inode, wh_old,S_IRUGO , &nd);unlock_dir (lower_parent); -if (!local_err) +if (!local_err) {set_dbopaque (old_dentry, bwh_old); -else { + }else {/* * we can't fix anything now, so we cop-out and use * -EIO.
@@ -392,8 +394,9 @@ static int may_rename_dir(struct dentry *dentry)if (err == -ENOTEMPTY ) {if (is_robranch (dentry))return -EXDEV ; - }else if (err) + }else if (err) {return err; + } bstart =dbstart (dentry);if (dbend (dentry) == bstart ||dbopaque (dentry) == bstart)
@@ -443,9 +446,9 @@ int unionfs_rename(struct inode *old_dir, struct dentry *old_dentry,* simply override it even if the whited-out dir is not empty. */ wh_dentry =lookup_whiteout (new_dentry); -if (!IS_ERR (wh_dentry)) +if (!IS_ERR (wh_dentry)) {dput (wh_dentry); -else if (new_dentry->d_inode) { + }else if (new_dentry->d_inode) {if (S_ISDIR (old_dentry->d_inode->i_mode) !=S_ISDIR (new_dentry->d_inode->i_mode)) { err = S_ISDIR(old_dentry->d_inode->i_mode) ?
@@ -473,10 +476,10 @@ int unionfs_rename(struct inode *old_dir, struct dentry *old_dentry, } err =do_unionfs_rename (old_dir, old_dentry, new_dir, new_dentry); out: -if (err) +if (err) {/* clear the new_dentry stuff created */ d_drop (new_dentry); -else { + }else {/* * force re-lookup since the dir on ro branch is not renamed, * and lower dentries still indicate the un-renamed ones.
fs/unionfs/unlink.c +5 -4
@@ -55,11 +55,12 @@ static int unionfs_unlink_whiteout(struct inode *dir, struct dentry *dentry)if (dbstart (dentry) ==0 ) goto out; err =create_whiteout (dentry,dbstart (dentry) -1 ); - }else if (dbopaque (dentry) !=-1 ) + }else if (dbopaque (dentry) !=-1 ) {/* There is a lower lower-priority file with the same name. */ err =create_whiteout (dentry,dbopaque (dentry)); -else + }else { err =create_whiteout (dentry,dbstart (dentry)); + } out:if (!err)
@@ -161,9 +162,9 @@ int unionfs_rmdir(struct inode *dir, struct dentry *dentry) err =unionfs_rmdir_first (dir, dentry, namelist);/* create whiteout */ -if (!err) +if (!err) { err =create_whiteout (dentry,dbstart (dentry)); -else { + }else {int new_err;if (dbstart (dentry) ==0 )
Signature · 1 line
1.5.2.2
PATCH 15/19 Unionfs: coding style: proper spacing
In reply to Erez Zadok--- fs/unionfs/copyup.c | 2 +- fs/unionfs/debug.c | 22 +++++++++++----------- fs/unionfs/dentry.c | 8 ++++---- fs/unionfs/fanout.h | 2 +- fs/unionfs/super.c | 14 +++++++------- fs/unionfs/union.h | 38 +++++++++++++++++++------------------- 6 files changed, 43 insertions(+), 43 deletions(-)
fs/unionfs/copyup.c +1 -1
@@ -875,7 +875,7 @@ void unionfs_postcopyup_release(struct dentry *dentry)int bindex;BUG_ON (S_ISDIR (dentry->d_inode->i_mode)); -for (bindex=dbstart (dentry)+1 ; bindex<=dbend (dentry); bindex++) { +for (bindex =dbstart (dentry)+1 ; bindex <=dbend (dentry); bindex++) {if (unionfs_lower_mnt_idx (dentry, bindex)) {unionfs_mntput (dentry, bindex);unionfs_set_lower_mnt_idx (dentry, bindex,NULL );
fs/unionfs/debug.c +11 -11
@@ -20,7 +20,7 @@#define PRINT_CALLER (fname, fxn, line) \ do { \ if (!printed_caller) { \ - pr_debug("PC:%s:%s:%d\n",(fname),(fxn),(line)); \ + pr_debug("PC:%s:%s:%d\n", (fname), (fxn), (line)); \ printed_caller = 1; \ } \ } while (0)
@@ -310,7 +310,7 @@ void __unionfs_check_dentry(const struct dentry *dentry,/* check if lower inode is newer than upper one (it shouldn't) */ if (unlikely (is_newer_lower (dentry))) {PRINT_CALLER (fname, fxn, line); -for (bindex=ibstart (inode); bindex <=ibend (inode); bindex++) { +for (bindex =ibstart (inode); bindex <=ibend (inode); bindex++) { lower_inode =unionfs_lower_inode_idx (inode, bindex);if (unlikely (!lower_inode))continue ;
@@ -413,7 +413,7 @@ void __unionfs_check_file(const struct file *file, } } -__unionfs_check_dentry (dentry,fname,fxn,line); +__unionfs_check_dentry (dentry, fname, fxn, line); } void __unionfs_check_nd(const struct nameidata *nd,
@@ -445,14 +445,14 @@ void __show_branch_counts(const struct super_block *sb,struct vfsmount *mnt;pr_debug ("BC:" ); -for (i=0 ; i<sbmax (sb); i++) { +for (i =0 ; i <sbmax (sb); i++) {if (likely (sb->s_root)) mnt =UNIONFS_D (sb->s_root)->lower_paths[i].mnt;else mnt =NULL ;pr_debug ("%d:" , (mnt ?atomic_read (&mnt->mnt_count) :-99 )); } -pr_debug ("%s:%s:%d\n" ,file,fxn,line); +pr_debug ("%s:%s:%d\n" , file, fxn, line); } void __show_inode_times(const struct inode *inode,
@@ -461,12 +461,12 @@ void __show_inode_times(const struct inode *inode,struct inode *lower_inode;int bindex; -for (bindex=ibstart (inode); bindex <=ibend (inode); bindex++) { +for (bindex =ibstart (inode); bindex <=ibend (inode); bindex++) { lower_inode =unionfs_lower_inode_idx (inode, bindex);if (unlikely (!lower_inode))continue ;pr_debug ("IT(%lu:%d): " , inode->i_ino, bindex); -pr_debug ("%s:%s:%d " ,file,fxn,line); +pr_debug ("%s:%s:%d " , file, fxn, line); pr_debug("um=%lu/%lu lm=%lu/%lu ", inode->i_mtime.tv_sec, inode->i_mtime.tv_nsec, lower_inode->i_mtime.tv_sec,
@@ -485,13 +485,13 @@ void __show_dinode_times(const struct dentry *dentry,struct inode *lower_inode;int bindex; -for (bindex=ibstart (inode); bindex <=ibend (inode); bindex++) { +for (bindex =ibstart (inode); bindex <=ibend (inode); bindex++) { lower_inode =unionfs_lower_inode_idx (inode, bindex);if (!lower_inode)continue ;pr_debug ("DT(%s:%lu:%d): " , dentry->d_name.name, inode->i_ino, bindex); -pr_debug ("%s:%s:%d " ,file,fxn,line); +pr_debug ("%s:%s:%d " , file, fxn, line); pr_debug("um=%lu/%lu lm=%lu/%lu ", inode->i_mtime.tv_sec, inode->i_mtime.tv_nsec, lower_inode->i_mtime.tv_sec,
@@ -513,7 +513,7 @@ void __show_inode_counts(const struct inode *inode,pr_debug ("SiC: Null inode\n" );return ; } -for (bindex=sbstart (inode->i_sb); bindex <=sbend (inode->i_sb); +for (bindex =sbstart (inode->i_sb); bindex <=sbend (inode->i_sb); bindex++) { lower_inode =unionfs_lower_inode_idx (inode, bindex);if (unlikely (!lower_inode))
@@ -521,6 +521,6 @@ void __show_inode_counts(const struct inode *inode,pr_debug ("SIC(%lu:%d:%d): " , inode->i_ino, bindex,atomic_read (&(inode)->i_count));pr_debug ("lc=%d " ,atomic_read (&(lower_inode)->i_count)); -pr_debug ("%s:%s:%d\n" ,file,fxn,line); +pr_debug ("%s:%s:%d\n" , file, fxn, line); } }
fs/unionfs/dentry.c +4 -4
@@ -337,7 +337,7 @@ bool __unionfs_d_revalidate_chain(struct dentry *dentry, struct nameidata *nd,* if failed, then sleep for a little, then retry. */ dtmp = dentry->d_parent; -for (i=chain_len-1 ; i>=0 ; i--) { +for (i = chain_len-1 ; i >=0 ; i--) { chain[i] =dget (dtmp); dtmp = dtmp->d_parent; }
@@ -346,7 +346,7 @@ bool __unionfs_d_revalidate_chain(struct dentry *dentry, struct nameidata *nd,* call __unionfs_d_revalidate_one() on each dentry, but in parent * to child order. */ -for (i=0 ; i<chain_len; i++) { +for (i =0 ; i < chain_len; i++) {unionfs_lock_dentry (chain[i]); saved_bstart =dbstart (chain[i]); saved_bend =dbend (chain[i]);
@@ -409,7 +409,7 @@ out_this: out_free:/* unlock/dput all dentries in chain and return status */ if (chain_len >0 ) { -for (i=0 ; i<chain_len; i++) +for (i =0 ; i < chain_len; i++)dput (chain[i]);kfree (chain); }
@@ -467,7 +467,7 @@ static void unionfs_d_release(struct dentry *dentry)dput (unionfs_lower_dentry_idx (dentry, bindex));unionfs_set_lower_dentry_idx (dentry, bindex,NULL );/* NULL lower mnt is ok if this is a negative dentry */ -if (!dentry->d_inode && !unionfs_lower_mnt_idx (dentry,bindex)) +if (!dentry->d_inode && !unionfs_lower_mnt_idx (dentry, bindex))continue ;unionfs_mntput (dentry, bindex);unionfs_set_lower_mnt_idx (dentry, bindex,NULL );
fs/unionfs/fanout.h +1 -1
@@ -310,7 +310,7 @@ static inline void unionfs_copy_attr_times(struct inode *upper)if (!upper ||ibstart (upper) <0 )return ; -for (bindex=ibstart (upper); bindex <=ibend (upper); bindex++) { +for (bindex =ibstart (upper); bindex <=ibend (upper); bindex++) { lower =unionfs_lower_inode_idx (upper, bindex);if (!lower)continue ;/* not all lower dir objects may exist */
fs/unionfs/super.c +7 -7
@@ -202,7 +202,7 @@ static noinline int do_remount_mode_option(char *optarg, int cur_branches, optarg, err); goto out; } -for (idx=0 ; idx<cur_branches; idx++) +for (idx =0 ; idx < cur_branches; idx++)if (nd.mnt == new_lower_paths[idx].mnt && nd.dentry == new_lower_paths[idx].dentry)break ;
@@ -245,7 +245,7 @@ static noinline int do_remount_del_option(char *optarg, int cur_branches, optarg, err); goto out; } -for (idx=0 ; idx < cur_branches; idx++) +for (idx =0 ; idx < cur_branches; idx++)if (nd.mnt == new_lower_paths[idx].mnt && nd.dentry == new_lower_paths[idx].dentry)break ;
@@ -329,7 +329,7 @@ static noinline int do_remount_add_option(char *optarg, int cur_branches, optarg, err); goto out; } -for (idx=0 ; idx < cur_branches; idx++) +for (idx =0 ; idx < cur_branches; idx++)if (nd.mnt == new_lower_paths[idx].mnt && nd.dentry == new_lower_paths[idx].dentry)break ;
@@ -540,7 +540,7 @@ static int unionfs_remount_fs(struct super_block *sb, int *flags, cur_branches * sizeof(struct unionfs_data));memcpy (tmp_lower_paths,UNIONFS_D (sb->s_root)->lower_paths, cur_branches *sizeof (struct path )); -for (i=0 ; i<cur_branches; i++) +for (i =0 ; i < cur_branches; i++)pathget (&tmp_lower_paths[i]);/* drop refs at end of fxn */ /*******************************************************************
@@ -743,14 +743,14 @@ out_no_change:* Update lower inodes: 3 steps * 1. grab ref on all new lower inodes */ -for (i=dbstart (sb->s_root); i<=dbend (sb->s_root); i++) { +for (i =dbstart (sb->s_root); i <=dbend (sb->s_root); i++) {struct dentry *lower_dentry =unionfs_lower_dentry_idx (sb->s_root, i);igrab (lower_dentry->d_inode); new_lower_inodes[i] = lower_dentry->d_inode; }/* 2. release reference on all older lower inodes */ -for (i=old_ibstart; i<=old_ibend; i++) { +for (i = old_ibstart; i <= old_ibend; i++) {iput (unionfs_lower_inode_idx (sb->s_root->d_inode, i));unionfs_set_lower_inode_idx (sb->s_root->d_inode, i,NULL ); }
@@ -785,7 +785,7 @@ out_no_change: out_release:/* no need to cleanup/release anything in tmp_data */ if (tmp_lower_paths) -for (i=0 ; i<new_branches; i++) +for (i =0 ; i < new_branches; i++)pathput (&tmp_lower_paths[i]); out_free:kfree (tmp_lower_paths);
fs/unionfs/union.h +19 -19
@@ -392,7 +392,7 @@ static inline int is_robranch_super(const struct super_block *sb, int index) {int ret; - ret = (!(branchperms (sb, index) &MAY_WRITE )) ? -EROFS :0 ; + ret = (!(branchperms (sb, index) &MAY_WRITE )) ? -EROFS :0 ;return ret; }
@@ -507,24 +507,24 @@ static inline void unionfs_mntput(struct dentry *dentry, int bindex)#ifdef CONFIG_UNION_FS_DEBUG /* useful for tracking code reachability */ -#define UDBG pr_debug("DBG:%s:%s:%d\n",__FILE__,__FUNCTION__,__LINE__) +#define UDBG pr_debug("DBG:%s:%s:%d\n", __FILE__, __FUNCTION__, __LINE__)#define unionfs_check_inode (i) __unionfs_check_inode((i), \ - __FILE__,__FUNCTION__,__LINE__) + __FILE__, __FUNCTION__, __LINE__)#define unionfs_check_dentry (d) __unionfs_check_dentry((d), \ - __FILE__,__FUNCTION__,__LINE__) + __FILE__, __FUNCTION__, __LINE__)#define unionfs_check_file (f) __unionfs_check_file((f), \ - __FILE__,__FUNCTION__,__LINE__) + __FILE__, __FUNCTION__, __LINE__)#define unionfs_check_nd (n) __unionfs_check_nd((n), \ - __FILE__,__FUNCTION__,__LINE__) + __FILE__, __FUNCTION__, __LINE__)#define show_branch_counts (sb) __show_branch_counts((sb), \ - __FILE__,__FUNCTION__,__LINE__) + __FILE__, __FUNCTION__, __LINE__)#define show_inode_times (i) __show_inode_times((i), \ - __FILE__,__FUNCTION__,__LINE__) + __FILE__, __FUNCTION__, __LINE__)#define show_dinode_times (d) __show_dinode_times((d), \ - __FILE__,__FUNCTION__,__LINE__) + __FILE__, __FUNCTION__, __LINE__)#define show_inode_counts (i) __show_inode_counts((i), \ - __FILE__,__FUNCTION__,__LINE__) + __FILE__, __FUNCTION__, __LINE__)extern void __unionfs_check_inode (const struct inode *inode,const char *fname,const char *fxn,int line);
@@ -542,19 +542,19 @@ extern void __show_inode_times(const struct inode *inode,extern void __show_dinode_times (const struct dentry *dentry,const char *file,const char *fxn,int line);extern void __show_inode_counts (const struct inode *inode, -const char *file,const char *fxn,int line); +const char *file,const char *fxn,int line);#else /* not CONFIG_UNION_FS_DEBUG */ /* we leave useful hooks for these check functions throughout the code */ -#define unionfs_check_inode (i) do { } while(0) -#define unionfs_check_dentry (d) do { } while(0) -#define unionfs_check_file (f) do { } while(0) -#define unionfs_check_nd (n) do { } while(0) -#define show_branch_counts (sb) do { } while(0) -#define show_inode_times (i) do { } while(0) -#define show_dinode_times (d) do { } while(0) -#define show_inode_counts (i) do { } while(0) +#define unionfs_check_inode (i) do { } while (0) +#define unionfs_check_dentry (d) do { } while (0) +#define unionfs_check_file (f) do { } while (0) +#define unionfs_check_nd (n) do { } while (0) +#define show_branch_counts (sb) do { } while (0) +#define show_inode_times (i) do { } while (0) +#define show_dinode_times (d) do { } while (0) +#define show_inode_counts (i) do { } while (0)#endif /* not CONFIG_UNION_FS_DEBUG */
Signature · 1 line
1.5.2.2
PATCH 16/19 Unionfs: coding style: take assignments out of "if" conditions
In reply to Erez Zadok--- fs/unionfs/commonfops.c | 12 ++++++++---- fs/unionfs/copyup.c | 9 ++++++--- fs/unionfs/dirfops.c | 6 ++++-- fs/unionfs/dirhelper.c | 3 ++- fs/unionfs/file.c | 18 ++++++++++++------ fs/unionfs/inode.c | 18 ++++++++++++------ fs/unionfs/lookup.c | 6 ++++-- fs/unionfs/main.c | 18 ++++++++++++------ fs/unionfs/mmap.c | 6 ++++-- fs/unionfs/rdstate.c | 3 ++- fs/unionfs/rename.c | 6 ++++-- fs/unionfs/subr.c | 3 ++- fs/unionfs/super.c | 3 ++- fs/unionfs/unlink.c | 9 ++++++--- 14 files changed, 80 insertions(+), 40 deletions(-)
fs/unionfs/commonfops.c +8 -4
@@ -614,7 +614,8 @@ int unionfs_file_release(struct inode *inode, struct file *file)* This is important for open-but-unlinked files, as well as mmap * support. */ -if (unlikely ((err =unionfs_file_revalidate (file, true)))) + err =unionfs_file_revalidate (file, true); +if (unlikely (err)) goto out;unionfs_check_file (file); fileinfo =UNIONFS_F (file);
@@ -707,7 +708,8 @@ static int unionfs_ioctl_queryfile(struct file *file, unsigned int cmd,unionfs_lock_dentry (dentry); orig_bstart =dbstart (dentry); orig_bend =dbend (dentry); -if ((err =unionfs_partial_lookup (dentry))) + err =unionfs_partial_lookup (dentry); +if (err) goto out; bstart =dbstart (dentry); bend =dbend (dentry);
@@ -755,7 +757,8 @@ long unionfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg)unionfs_read_lock (file->f_path.dentry->d_sb); -if (unlikely ((err =unionfs_file_revalidate (file, true)))) + err =unionfs_file_revalidate (file, true); +if (unlikely (err)) goto out;/* check if asked for local commands */
@@ -793,7 +796,8 @@ int unionfs_flush(struct file *file, fl_owner_t id)unionfs_read_lock (dentry->d_sb); -if (unlikely ((err =unionfs_file_revalidate (file, true)))) + err =unionfs_file_revalidate (file, true); +if (unlikely (err)) goto out;unionfs_check_file (file);
fs/unionfs/copyup.c +6 -3
@@ -394,7 +394,8 @@ int copyup_dentry(struct inode *dir, struct dentry *dentry, int bstart, sb = dir->i_sb; -if ((err =is_robranch_super (sb, new_bindex))) + err =is_robranch_super (sb, new_bindex); +if (err) goto out;/* Create the directory structure above this dentry. */
@@ -465,7 +466,8 @@ int copyup_dentry(struct inode *dir, struct dentry *dentry, int bstart,#ifdef CONFIG_UNION_FS_XATTR /* Selinux uses extended attributes for permissions. */ -if ((err =copyup_xattrs (old_lower_dentry, new_lower_dentry))) + err =copyup_xattrs (old_lower_dentry, new_lower_dentry); +if (err) goto out_unlink;#endif /* CONFIG_UNION_FS_XATTR */
@@ -679,7 +681,8 @@ struct dentry *create_parents(struct inode *dir, struct dentry *dentry,verify_locked (dentry); -if ((err =is_robranch_super (dir->i_sb, bindex))) { + err =is_robranch_super (dir->i_sb, bindex); +if (err) { lower_dentry =ERR_PTR (err); goto out; }
fs/unionfs/dirfops.c +4 -2
@@ -97,7 +97,8 @@ static int unionfs_readdir(struct file *file, void *dirent, filldir_t filldir)unionfs_read_lock (file->f_path.dentry->d_sb); -if (unlikely ((err =unionfs_file_revalidate (file, false)))) + err =unionfs_file_revalidate (file, false); +if (unlikely (err)) goto out; inode = file->f_path.dentry->d_inode;
@@ -200,7 +201,8 @@ static loff_t unionfs_dir_llseek(struct file *file, loff_t offset, int origin)unionfs_read_lock (file->f_path.dentry->d_sb); -if (unlikely ((err =unionfs_file_revalidate (file, false)))) + err =unionfs_file_revalidate (file, false); +if (unlikely (err)) goto out; rdstate =UNIONFS_F (file)->rdstate;
fs/unionfs/dirhelper.c +2 -1
@@ -194,7 +194,8 @@ int check_empty(struct dentry *dentry, struct unionfs_dir_state **namelist)BUG_ON (!S_ISDIR (dentry->d_inode->i_mode)); -if ((err =unionfs_partial_lookup (dentry))) + err =unionfs_partial_lookup (dentry); +if (err) goto out; bstart =dbstart (dentry);
fs/unionfs/file.c +12 -6
@@ -24,7 +24,8 @@ static ssize_t unionfs_read(struct file *file, char __user *buf,int err;unionfs_read_lock (file->f_path.dentry->d_sb); -if (unlikely ((err =unionfs_file_revalidate (file, false)))) + err =unionfs_file_revalidate (file, false); +if (unlikely (err)) goto out;unionfs_check_file (file);
@@ -47,7 +48,8 @@ static ssize_t unionfs_aio_read(struct kiocb *iocb, const struct iovec *iov,struct file *file = iocb->ki_filp;unionfs_read_lock (file->f_path.dentry->d_sb); -if (unlikely ((err =unionfs_file_revalidate (file, false)))) + err =unionfs_file_revalidate (file, false); +if (unlikely (err)) goto out;unionfs_check_file (file);
@@ -72,7 +74,8 @@ static ssize_t unionfs_write(struct file *file, const char __user *buf,int err =0 ;unionfs_read_lock (file->f_path.dentry->d_sb); -if (unlikely ((err =unionfs_file_revalidate (file, true)))) + err =unionfs_file_revalidate (file, true); +if (unlikely (err)) goto out;unionfs_check_file (file);
@@ -104,7 +107,8 @@ static int unionfs_mmap(struct file *file, struct vm_area_struct *vma)/* This might be deferred to mmap's writepage */ willwrite = ((vma->vm_flags |VM_SHARED |VM_WRITE ) == vma->vm_flags); -if (unlikely ((err =unionfs_file_revalidate (file, willwrite)))) + err =unionfs_file_revalidate (file, willwrite); +if (unlikely (err)) goto out;unionfs_check_file (file);
@@ -150,7 +154,8 @@ int unionfs_fsync(struct file *file, struct dentry *dentry, int datasync)int err = -EINVAL ;unionfs_read_lock (file->f_path.dentry->d_sb); -if (unlikely ((err =unionfs_file_revalidate (file, true)))) + err =unionfs_file_revalidate (file, true); +if (unlikely (err)) goto out;unionfs_check_file (file);
@@ -197,7 +202,8 @@ int unionfs_fasync(int fd, struct file *file, int flag)int err =0 ;unionfs_read_lock (file->f_path.dentry->d_sb); -if (unlikely ((err =unionfs_file_revalidate (file, true)))) + err =unionfs_file_revalidate (file, true); +if (unlikely (err)) goto out;unionfs_check_file (file);
fs/unionfs/inode.c +12 -6
@@ -51,7 +51,8 @@ static int unionfs_create(struct inode *parent, struct dentry *dentry,* bit redundant as we don't allow branch 0 to be read-only at the * moment */ -if ((err =is_robranch_super (dentry->d_sb,0 ))) { + err =is_robranch_super (dentry->d_sb,0 ); +if (err) { err = -EROFS ; goto out; }
@@ -278,7 +279,8 @@ static int unionfs_link(struct dentry *old_dentry, struct inode *dir,BUG_ON (dbstart (old_dentry) !=dbstart (new_dentry)); lower_dir_dentry =lock_parent (lower_new_dentry); -if (!(err =is_robranch (old_dentry))) + err =is_robranch (old_dentry); +if (!err) err =vfs_link (lower_old_dentry, lower_dir_dentry->d_inode, lower_new_dentry);unlock_dir (lower_dir_dentry);
@@ -401,7 +403,8 @@ static int unionfs_symlink(struct inode *dir, struct dentry *dentry,*/ lower_dir_dentry =lock_parent (whiteout_dentry); -if (!(err =is_robranch_super (dentry->d_sb, bstart))) + err =is_robranch_super (dentry->d_sb, bstart); +if (!err) err =vfs_unlink (lower_dir_dentry->d_inode, whiteout_dentry);dput (whiteout_dentry);
@@ -455,7 +458,8 @@ static int unionfs_symlink(struct inode *dir, struct dentry *dentry, lower_dir_dentry =lock_parent (lower_dentry); -if (!(err =is_robranch_super (dentry->d_sb, bindex))) { + err =is_robranch_super (dentry->d_sb, bindex); +if (!err) { mode =S_IALLUGO ; err =vfs_symlink (lower_dir_dentry->d_inode, lower_dentry, symname, mode);
@@ -556,7 +560,8 @@ static int unionfs_mkdir(struct inode *parent, struct dentry *dentry, int mode) lower_parent_dentry =lock_parent (whiteout_dentry);/* found a.wh.foo entry, remove it then do vfs_mkdir */ -if (!(err =is_robranch_super (dentry->d_sb, bstart))) { + err =is_robranch_super (dentry->d_sb, bstart); +if (!err) { args.unlink.parent = lower_parent_dentry->d_inode; args.unlink.dentry = whiteout_dentry;run_sioq (__unionfs_unlink, &args);
@@ -708,7 +713,8 @@ static int unionfs_mknod(struct inode *dir, struct dentry *dentry, int mode, lower_parent_dentry =lock_parent (whiteout_dentry);/* found a.wh.foo entry, remove it then do vfs_mkdir */ -if (!(err =is_robranch_super (dentry->d_sb, bstart))) + err =is_robranch_super (dentry->d_sb, bstart); +if (!err) err =vfs_unlink (lower_parent_dentry->d_inode, whiteout_dentry);dput (whiteout_dentry);
fs/unionfs/lookup.c +4 -2
@@ -119,12 +119,14 @@ struct dentry *unionfs_lookup_backend(struct dentry *dentry,case INTERPOSE_PARTIAL :break ;case INTERPOSE_LOOKUP : -if (unlikely ((err =new_dentry_private_data (dentry)))) + err =new_dentry_private_data (dentry); +if (unlikely (err)) goto out;break ;default :/* default: can only be INTERPOSE_REVAL/REVAL_NEG */ -if (unlikely ((err =realloc_dentry_private_data (dentry)))) + err =realloc_dentry_private_data (dentry); +if (unlikely (err)) goto out;break ; }
fs/unionfs/main.c +12 -6
@@ -364,7 +364,8 @@ static int parse_dirs_option(struct super_block *sb, struct unionfs_dentry_info goto out; } -if ((err =check_branch (&nd))) { + err =check_branch (&nd); +if (err) {printk (KERN_ERR "unionfs: lower directory " "'%s' is not a valid branch\n" , name);path_release (&nd);
@@ -648,7 +649,8 @@ static int unionfs_read_super(struct super_block *sb, void *raw_data,/* link the upper and lower dentries */ sb->s_root->d_fsdata =NULL ; -if (unlikely ((err =new_dentry_private_data (sb->s_root)))) + err =new_dentry_private_data (sb->s_root); +if (unlikely (err)) goto out_freedpd;/* Set the lower dentries for s_root */
@@ -738,13 +740,17 @@ static int __init init_unionfs_fs(void)pr_info ("Registering unionfs " UNIONFS_VERSION "\n" ); -if (unlikely ((err =unionfs_init_filldir_cache ()))) + err =unionfs_init_filldir_cache (); +if (unlikely (err)) goto out; -if (unlikely ((err =unionfs_init_inode_cache ()))) + err =unionfs_init_inode_cache (); +if (unlikely (err)) goto out; -if (unlikely ((err =unionfs_init_dentry_cache ()))) + err =unionfs_init_dentry_cache (); +if (unlikely (err)) goto out; -if (unlikely ((err =init_sioq ()))) + err =init_sioq (); +if (unlikely (err)) goto out; err =register_filesystem (&unionfs_fs_type); out:
fs/unionfs/mmap.c +4 -2
@@ -211,7 +211,8 @@ static int unionfs_readpage(struct file *file, struct page *page)int err;unionfs_read_lock (file->f_path.dentry->d_sb); -if (unlikely ((err =unionfs_file_revalidate (file, false)))) + err =unionfs_file_revalidate (file, false); +if (unlikely (err)) goto out;unionfs_check_file (file);
@@ -275,7 +276,8 @@ static int unionfs_commit_write(struct file *file, struct page *page,BUG_ON (file ==NULL );unionfs_read_lock (file->f_path.dentry->d_sb); -if (unlikely ((err =unionfs_file_revalidate (file, true)))) + err =unionfs_file_revalidate (file, true); +if (unlikely (err)) goto out;unionfs_check_file (file);
fs/unionfs/rdstate.c +2 -1
@@ -72,7 +72,8 @@ static int guesstimate_hash_size(struct inode *inode)return UNIONFS_I (inode)->hashsize;for (bindex =ibstart (inode); bindex <=ibend (inode); bindex++) { -if (!(lower_inode =unionfs_lower_inode_idx (inode, bindex))) + lower_inode =unionfs_lower_inode_idx (inode, bindex); +if (!lower_inode)continue ;if (lower_inode->i_size ==DENTPAGE )
fs/unionfs/rename.c +4 -2
@@ -75,7 +75,8 @@ static int __unionfs_rename(struct inode *old_dir, struct dentry *old_dentry, } lower_wh_dir_dentry =lock_parent (lower_wh_dentry); -if (!(err =is_robranch_super (old_dentry->d_sb, bindex))) + err =is_robranch_super (old_dentry->d_sb, bindex); +if (!err) err =vfs_unlink (lower_wh_dir_dentry->d_inode, lower_wh_dentry);
@@ -196,7 +197,8 @@ static int do_unionfs_rename(struct inode *old_dir,continue ; unlink_dir_dentry =lock_parent (unlink_dentry); -if (!(err =is_robranch_super (old_dir->i_sb, bindex))) + err =is_robranch_super (old_dir->i_sb, bindex); +if (!err) err =vfs_unlink (unlink_dir_dentry->d_inode, unlink_dentry);
fs/unionfs/subr.c +2 -1
@@ -87,7 +87,8 @@ int create_whiteout(struct dentry *dentry, int start)if (unlikely (err <0 )) goto out; lower_dir_dentry =lock_parent (lower_wh_dentry); -if (!(err =is_robranch_super (dentry->d_sb, bindex))) + err =is_robranch_super (dentry->d_sb, bindex); +if (!err) err = vfs_create(lower_dir_dentry->d_inode, lower_wh_dentry, ~current->fs->umask & S_IRWXUGO,
fs/unionfs/super.c +2 -1
@@ -372,7 +372,8 @@ found_insertion_point:* because this code base doesn't support stacking unionfs: the ODF * code base supports that correctly. */ -if ((err =check_branch (&nd))) { + err =check_branch (&nd); +if (err) {printk (KERN_ERR "unionfs: lower directory " "\"%s\" is not a valid branch\n" , optarg);path_release (&nd);
fs/unionfs/unlink.c +6 -3
@@ -26,7 +26,8 @@ static int unionfs_unlink_whiteout(struct inode *dir, struct dentry *dentry)int bindex;int err =0 ; -if ((err =unionfs_partial_lookup (dentry))) + err =unionfs_partial_lookup (dentry); +if (err) goto out; bindex =dbstart (dentry);
@@ -39,7 +40,8 @@ static int unionfs_unlink_whiteout(struct inode *dir, struct dentry *dentry)/* avoid destroying the lower inode if the file is in use */ dget (lower_dentry); -if (!(err =is_robranch_super (dentry->d_sb, bindex))) + err =is_robranch_super (dentry->d_sb, bindex); +if (!err) err =vfs_unlink (lower_dir_dentry->d_inode, lower_dentry);/* if vfs_unlink succeeded, update our inode's times */ if (!err)
@@ -127,7 +129,8 @@ static int unionfs_rmdir_first(struct inode *dir, struct dentry *dentry,/* avoid destroying the lower inode if the file is in use */ dget (lower_dentry); -if (!(err =is_robranch (dentry))) + err =is_robranch (dentry); +if (!err) err =vfs_rmdir (lower_dir_dentry->d_inode, lower_dentry);dput (lower_dentry);
Signature · 1 line
1.5.2.2
PATCH 17/19 Unionfs: coding style: avoid multiple assignments on same line
In reply to Erez Zadok--- fs/unionfs/mmap.c | 3 ++- fs/unionfs/super.c | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-)
fs/unionfs/mmap.c +2 -1
@@ -179,7 +179,8 @@ static int unionfs_do_readpage(struct file *file, struct page *page)* may be a little slower, but a lot safer, as the VFS does a lot of * the necessary magic for us. */ - offset = lower_file->f_pos =page_offset (page); + lower_file->f_pos =page_offset (page); + offset =page_offset (page); old_fs =get_fs ();set_fs (KERNEL_DS ); err = vfs_read(lower_file, page_data, PAGE_CACHE_SIZE,
fs/unionfs/super.c +6 -3
@@ -477,13 +477,16 @@ static int unionfs_remount_fs(struct super_block *sb, int *flags,* "add" and "del" commands. Copy the "options" string because * strsep modifies the string and we need it later. */ - optionstmp = tmp_to_free =kstrdup (options,GFP_KERNEL ); + tmp_to_free =kstrdup (options,GFP_KERNEL ); + optionstmp = tmp_to_free;if (unlikely (!optionstmp)) { err = -ENOMEM ; goto out_free; } - new_branches = cur_branches =sbmax (sb);/* current no. branches */ - add_branches = del_branches =0 ; + cur_branches =sbmax (sb);/* current no. branches */ + new_branches =sbmax (sb); + del_branches =0 ; + add_branches =0 ; new_high_branch_id =sbhbid (sb);/* save current high_branch_id */ while ((optname =strsep (&optionstmp,"," )) !=NULL ) {char *optarg;
Signature · 1 line
1.5.2.2
PATCH 18/19 Unionfs: coding style: miscellaneous fixes
In reply to Erez ZadokNo braces around single-statement if's. No externs in .c files.
use <linux/mman.h> not <asm/mman.h>. Use (foo *) not (foo*).
--- fs/unionfs/rdstate.c | 3 +-- fs/unionfs/super.c | 3 +-- fs/unionfs/union.h | 3 ++- fs/unionfs/xattr.c | 6 +++--- 4 files changed, 7 insertions(+), 8 deletions(-)
fs/unionfs/rdstate.c +1 -2
@@ -218,12 +218,11 @@ struct filldir_node *find_filldir_node(struct unionfs_dir_state *rdstate,* if the duplicate is in this branch, then the file * system is corrupted. */ -if (unlikely (cursor->bindex == rdstate->bindex)) { +if (unlikely (cursor->bindex == rdstate->bindex))printk (KERN_ERR "unionfs: filldir: possible " "I/O error: a file is duplicated " "in the same branch %d: %s\n" , rdstate->bindex, cursor->name); - }break ; } }
fs/unionfs/super.c +1 -2
@@ -26,7 +26,6 @@ static struct kmem_cache *unionfs_inode_cachep;static void unionfs_read_inode (struct inode *inode) { -extern struct address_space_operations unionfs_aops;int size;struct unionfs_inode_info *info =UNIONFS_I (inode);
@@ -965,7 +964,7 @@ static int unionfs_show_options(struct seq_file *m, struct vfsmount *mnt)unionfs_lock_dentry (sb->s_root); - tmp_page = (char *)__get_free_page (GFP_KERNEL ); + tmp_page = (char *)__get_free_page (GFP_KERNEL );if (unlikely (!tmp_page)) { ret = -ENOMEM ; goto out;
fs/unionfs/union.h +2 -1
@@ -44,8 +44,8 @@#include <linux/magic.h> #include <linux/log2.h> #include <linux/poison.h> +#include <linux/mman.h> -#include <asm/mman.h> #include <asm/system.h> #include <linux/union_fs.h>
@@ -70,6 +70,7 @@ extern struct inode_operations unionfs_dir_iops;extern struct inode_operations unionfs_symlink_iops;extern struct super_operations unionfs_sops;extern struct dentry_operations unionfs_dops; +extern struct address_space_operations unionfs_aops;/* How long should an entry be allowed to persist */ #define RDCACHE_JIFFIES (5*HZ)
fs/unionfs/xattr.c +3 -3
@@ -55,7 +55,7 @@ ssize_t unionfs_getxattr(struct dentry *dentry, const char *name, void *value, lower_dentry =unionfs_lower_dentry (dentry); - err =vfs_getxattr (lower_dentry, (char *) name, value, size); + err =vfs_getxattr (lower_dentry, (char *) name, value, size); out:unionfs_unlock_dentry (dentry);
@@ -84,7 +84,7 @@ int unionfs_setxattr(struct dentry *dentry, const char *name, lower_dentry =unionfs_lower_dentry (dentry); - err =vfs_setxattr (lower_dentry, (char *) name, (void *) value, + err =vfs_setxattr (lower_dentry, (char *) name, (void *) value, size, flags); out:
@@ -113,7 +113,7 @@ int unionfs_removexattr(struct dentry *dentry, const char *name) lower_dentry =unionfs_lower_dentry (dentry); - err =vfs_removexattr (lower_dentry, (char *) name); + err =vfs_removexattr (lower_dentry, (char *) name); out:unionfs_unlock_dentry (dentry);
Signature · 1 line
1.5.2.2
PATCH 19/19 Unionfs: coding style: avoid lines longer than 80 chars
In reply to Erez Zadok--- fs/unionfs/commonfops.c | 18 ++++++----- fs/unionfs/debug.c | 80 +++++++++++++++++++++++----------------------- fs/unionfs/dentry.c | 3 +- fs/unionfs/dirfops.c | 8 +++-- fs/unionfs/fanout.h | 9 +++-- 5 files changed, 63 insertions(+), 55 deletions(-)
fs/unionfs/commonfops.c +10 -8
@@ -339,7 +339,8 @@ int unionfs_file_revalidate(struct file *file, bool willwrite)if (unlikely (!d_deleted (dentry) && (sbgen > fgen ||dbstart (dentry) !=fbstart (file)))) {/* save orig branch ID */ -int orig_brid =UNIONFS_F (file)->saved_branch_ids[fbstart (file)]; +int orig_brid = +UNIONFS_F (file)->saved_branch_ids[fbstart (file)];/* First we throw out the existing files. */ cleanup_file (file);
@@ -388,7 +389,8 @@ int unionfs_file_revalidate(struct file *file, bool willwrite) } }atomic_set (&UNIONFS_F (file)->generation, -atomic_read (&UNIONFS_I (dentry->d_inode)->generation)); +atomic_read ( + &UNIONFS_I (dentry->d_inode)->generation)); }/* Copyup on the first write to a file on a readonly branch. */
@@ -418,6 +420,7 @@ static int __open_dir(struct inode *inode, struct file *file)struct dentry *lower_dentry;struct file *lower_file;int bindex, bstart, bend; +struct vfsmount *mnt; bstart =fbstart (file) =dbstart (file->f_path.dentry); bend =fbend (file) =dbend (file->f_path.dentry);
@@ -430,10 +433,8 @@ static int __open_dir(struct inode *inode, struct file *file)dget (lower_dentry);unionfs_mntget (file->f_path.dentry, bindex); - lower_file =dentry_open (lower_dentry, -unionfs_lower_mnt_idx (file->f_path.dentry, - bindex), - file->f_flags); + mnt =unionfs_lower_mnt_idx (file->f_path.dentry, bindex); + lower_file =dentry_open (lower_dentry, mnt, file->f_flags);if (IS_ERR (lower_file))return PTR_ERR (lower_file);
@@ -679,8 +680,9 @@ static long do_ioctl(struct file *file, unsigned int cmd, unsigned long arg) err = lower_file->f_op->unlocked_ioctl (lower_file, cmd, arg); }else if (lower_file->f_op->ioctl) {lock_kernel (); - err = lower_file->f_op->ioctl (lower_file->f_path.dentry->d_inode, - lower_file, cmd, arg); + err = lower_file->f_op->ioctl ( + lower_file->f_path.dentry->d_inode, + lower_file, cmd, arg);unlock_kernel (); }
fs/unionfs/debug.c +40 -40
104 lines not on this page · raw message
fs/unionfs/dentry.c +2 -1
@@ -328,7 +328,8 @@ bool __unionfs_d_revalidate_chain(struct dentry *dentry, struct nameidata *nd,*/ chain =kzalloc (chain_len *sizeof (struct dentry *),GFP_KERNEL );if (unlikely (!chain)) { -printk (KERN_CRIT "unionfs: no more memory in %s\n" , __FUNCTION__); +printk (KERN_CRIT "unionfs: no more memory in %s\n" , + __FUNCTION__); goto out; }
fs/unionfs/dirfops.c +5 -3
@@ -155,7 +155,8 @@ static int unionfs_readdir(struct file *file, void *dirent, filldir_t filldir) uds->dirpos = offset;/* Copy the atime. */ -fsstack_copy_attr_atime (inode, lower_file->f_path.dentry->d_inode); +fsstack_copy_attr_atime (inode, + lower_file->f_path.dentry->d_inode);if (err <0 ) goto out;
@@ -240,8 +241,9 @@ static loff_t unionfs_dir_llseek(struct file *file, loff_t offset, int origin)else err = -EINVAL ; }else { - rdstate =find_rdstate (file->f_path.dentry->d_inode, - offset); +struct inode *inode; + inode = file->f_path.dentry->d_inode; + rdstate =find_rdstate (inode, offset);if (rdstate) {UNIONFS_F (file)->rdstate = rdstate; err = rdstate->offset;
fs/unionfs/fanout.h +6 -3
@@ -314,11 +314,14 @@ static inline void unionfs_copy_attr_times(struct inode *upper) lower =unionfs_lower_inode_idx (upper, bindex);if (!lower)continue ;/* not all lower dir objects may exist */ -if (unlikely (timespec_compare (&upper->i_mtime, &lower->i_mtime) <0 )) +if (unlikely (timespec_compare (&upper->i_mtime, + &lower->i_mtime) <0 )) upper->i_mtime = lower->i_mtime; -if (unlikely (timespec_compare (&upper->i_ctime, &lower->i_ctime) <0 )) +if (unlikely (timespec_compare (&upper->i_ctime, + &lower->i_ctime) <0 )) upper->i_ctime = lower->i_ctime; -if (unlikely (timespec_compare (&upper->i_atime, &lower->i_atime) <0 )) +if (unlikely (timespec_compare (&upper->i_atime, + &lower->i_atime) <0 )) upper->i_atime = lower->i_atime; } }
Signature · 1 line
1.5.2.2