linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Erez Zadok <ezk@cs.sunysb.edu>
To: akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	viro@ftp.linux.org.uk, hch@infradead.org,
	Erez Zadok <ezk@cs.sunysb.edu>
Subject: [PATCH 01/12] Unionfs: minor code cleanups
Date: Fri, 25 Apr 2008 18:18:57 -0400	[thread overview]
Message-ID: <1209161949502-git-send-email-ezk@cs.sunysb.edu> (raw)
In-Reply-To: <12091619483888-git-send-email-ezk@cs.sunysb.edu>

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
---
 fs/unionfs/commonfops.c |    2 --
 fs/unionfs/file.c       |   17 +++++------------
 fs/unionfs/inode.c      |   39 +++++++++++++++++----------------------
 3 files changed, 22 insertions(+), 36 deletions(-)

diff --git a/fs/unionfs/commonfops.c b/fs/unionfs/commonfops.c
index 50f4eda..0fc7963 100644
--- a/fs/unionfs/commonfops.c
+++ b/fs/unionfs/commonfops.c
@@ -250,7 +250,6 @@ static int do_delayed_copyup(struct file *file)
 	BUG_ON(!S_ISREG(dentry->d_inode->i_mode));
 
 	unionfs_check_file(file);
-	unionfs_check_dentry(dentry);
 	for (bindex = bstart - 1; bindex >= 0; bindex--) {
 		if (!d_deleted(dentry))
 			err = copyup_file(parent_inode, file, bstart,
@@ -292,7 +291,6 @@ static int do_delayed_copyup(struct file *file)
 
 out:
 	unionfs_check_file(file);
-	unionfs_check_dentry(dentry);
 	return err;
 }
 
diff --git a/fs/unionfs/file.c b/fs/unionfs/file.c
index 0a39387..1fe4c30 100644
--- a/fs/unionfs/file.c
+++ b/fs/unionfs/file.c
@@ -35,14 +35,14 @@ static ssize_t unionfs_read(struct file *file, char __user *buf,
 	err = vfs_read(lower_file, buf, count, ppos);
 	/* update our inode atime upon a successful lower read */
 	if (err >= 0) {
-		fsstack_copy_attr_atime(file->f_path.dentry->d_inode,
+		fsstack_copy_attr_atime(dentry->d_inode,
 					lower_file->f_path.dentry->d_inode);
 		unionfs_check_file(file);
 	}
 
 out:
 	unionfs_unlock_dentry(dentry);
-	unionfs_read_unlock(file->f_path.dentry->d_sb);
+	unionfs_read_unlock(dentry->d_sb);
 	return err;
 }
 
@@ -63,32 +63,25 @@ static ssize_t unionfs_write(struct file *file, const char __user *buf,
 	err = vfs_write(lower_file, buf, count, ppos);
 	/* update our inode times+sizes upon a successful lower write */
 	if (err >= 0) {
-		fsstack_copy_inode_size(file->f_path.dentry->d_inode,
+		fsstack_copy_inode_size(dentry->d_inode,
 					lower_file->f_path.dentry->d_inode);
-		fsstack_copy_attr_times(file->f_path.dentry->d_inode,
+		fsstack_copy_attr_times(dentry->d_inode,
 					lower_file->f_path.dentry->d_inode);
 		unionfs_check_file(file);
 	}
 
 out:
 	unionfs_unlock_dentry(dentry);
-	unionfs_read_unlock(file->f_path.dentry->d_sb);
+	unionfs_read_unlock(dentry->d_sb);
 	return err;
 }
 
-
 static int unionfs_file_readdir(struct file *file, void *dirent,
 				filldir_t filldir)
 {
 	return -ENOTDIR;
 }
 
-int unionfs_readpage_dummy(struct file *file, struct page *page)
-{
-	BUG();
-	return -EINVAL;
-}
-
 static int unionfs_mmap(struct file *file, struct vm_area_struct *vma)
 {
 	int err = 0;
diff --git a/fs/unionfs/inode.c b/fs/unionfs/inode.c
index 0dc07ec..1446124 100644
--- a/fs/unionfs/inode.c
+++ b/fs/unionfs/inode.c
@@ -396,28 +396,23 @@ docopyup:
 					    bindex, old_dentry->d_name.name,
 					    old_dentry->d_name.len, NULL,
 					    i_size_read(old_dentry->d_inode));
-			if (!err) {
-				lower_new_dentry =
-					create_parents(dir, new_dentry,
-						       new_dentry->d_name.name,
-						       bindex);
-				lower_old_dentry =
-					unionfs_lower_dentry(old_dentry);
-				lower_dir_dentry =
-					lock_parent(lower_new_dentry);
-				/*
-				 * see
-				 * Documentation/filesystems/unionfs/issues.txt
-				 */
-				lockdep_off();
-				/* do vfs_link */
-				err = vfs_link(lower_old_dentry,
-					       lower_dir_dentry->d_inode,
-					       lower_new_dentry);
-				lockdep_on();
-				unlock_dir(lower_dir_dentry);
-				goto check_link;
-			}
+			if (err)
+				continue;
+			lower_new_dentry =
+				create_parents(dir, new_dentry,
+					       new_dentry->d_name.name,
+					       bindex);
+			lower_old_dentry = unionfs_lower_dentry(old_dentry);
+			lower_dir_dentry = lock_parent(lower_new_dentry);
+			/* see Documentation/filesystems/unionfs/issues.txt */
+			lockdep_off();
+			/* do vfs_link */
+			err = vfs_link(lower_old_dentry,
+				       lower_dir_dentry->d_inode,
+				       lower_new_dentry);
+			lockdep_on();
+			unlock_dir(lower_dir_dentry);
+			goto check_link;
 		}
 		goto out;
 	}
-- 
1.5.2.2


  reply	other threads:[~2008-04-25 22:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-25 22:18 [GIT PULL -mm] 00/12 Unionfs updates/fixes/cleanups Erez Zadok
2008-04-25 22:18 ` Erez Zadok [this message]
2008-04-25 22:18 ` [PATCH 02/12] Unionfs: prevent races in unionfs_fault Erez Zadok
2008-04-25 22:18 ` [PATCH 03/12] Unionfs: copy lower times in fsync/fasync only when needed Erez Zadok
2008-04-25 22:19 ` [PATCH 04/12] Unionfs: lock inode around calls to notify_change() Erez Zadok
2008-04-25 22:19 ` [PATCH 05/12] Unionfs: stop as soon as first writeable branch is found Erez Zadok
2008-04-25 22:19 ` [PATCH 06/12] Unionfs: don't dereference dentry without lower branches in d_release Erez Zadok
2008-04-25 22:19 ` [PATCH 07/12] Unionfs: set append offset correctly for copied-up files Erez Zadok
2008-04-25 22:19 ` [PATCH 08/12] Unionfs: copyup only if file is being written to Erez Zadok
2008-04-25 22:19 ` [PATCH 09/12] Unionfs: reorganize file_revalidate for un/locking callers Erez Zadok
2008-04-25 22:19 ` [PATCH 10/12] Unionfs: maintain one-open-file invariant for non-directories Erez Zadok
2008-04-25 22:19 ` [PATCH 11/12] Unionfs: set lower file to NULL in file_release Erez Zadok
2008-04-25 22:19 ` [PATCH 12/12] Unionfs: lock parent dentry branch config in write Erez Zadok

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1209161949502-git-send-email-ezk@cs.sunysb.edu \
    --to=ezk@cs.sunysb.edu \
    --cc=akpm@linux-foundation.org \
    --cc=hch@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@ftp.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).