All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Josef 'Jeff' Sipek" <jsipek@cs.sunysb.edu>
To: linux-kernel@vger.kernel.org
Cc: linux-fsdevel@vger.kernel.org, akpm@osdl.org,
	"Josef 'Jeff' Sipek" <jsipek@cs.sunysb.edu>
Subject: [PATCH 1/4] fs/unionfs/: Remove stale_inode.c
Date: Mon, 29 Jan 2007 15:37:39 -0500	[thread overview]
Message-ID: <11701030632165-git-send-email-jsipek@cs.sunysb.edu> (raw)
In-Reply-To: <11701030631109-git-send-email-jsipek@cs.sunysb.edu>

The stale inode operations were heavily based on bad inode operations. This
patch removes stale_inode.c and converts all users of stale_inode_ops to
bad_inode_ops as there seems to be no reason to return ESTALE instead of
EIO.

This is the more appropriate than porting the bad_inode.c fix (commit
be6aab0e9fa6d3c6d75aa1e38ac972d8b4ee82b8) to stale_inode.c.

Signed-off-by: Josef 'Jeff' Sipek <jsipek@cs.sunysb.edu>
---
 fs/unionfs/dentry.c      |    2 +-
 fs/unionfs/stale_inode.c |  112 ----------------------------------------------
 fs/unionfs/union.h       |    1 -
 3 files changed, 1 insertions(+), 114 deletions(-)
 delete mode 100644 fs/unionfs/stale_inode.c

diff --git a/fs/unionfs/dentry.c b/fs/unionfs/dentry.c
index 78de9c9..0b002d1 100644
--- a/fs/unionfs/dentry.c
+++ b/fs/unionfs/dentry.c
@@ -141,7 +141,7 @@ restart:
 		}
 
 		if (positive && UNIONFS_I(dentry->d_inode)->stale) {
-			make_stale_inode(dentry->d_inode);
+			make_bad_inode(dentry->d_inode);
 			d_drop(dentry);
 			valid = 0;
 			goto out;
diff --git a/fs/unionfs/stale_inode.c b/fs/unionfs/stale_inode.c
deleted file mode 100644
index bce938d..0000000
--- a/fs/unionfs/stale_inode.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- *  Adpated from linux/fs/bad_inode.c
- *
- *  Copyright (C) 1997, Stephen Tweedie
- *
- *  Provide stub functions for "stale" inodes, a bit friendlier than the
- *  -EIO that bad_inode.c does.
- */
-
-#include <linux/version.h>
-
-#include <linux/fs.h>
-#include <linux/stat.h>
-#include <linux/sched.h>
-
-static struct address_space_operations unionfs_stale_aops;
-
-/* declarations for "sparse */
-extern struct inode_operations stale_inode_ops;
-
-/*
- * The follow_link operation is special: it must behave as a no-op
- * so that a stale root inode can at least be unmounted. To do this
- * we must dput() the base and return the dentry with a dget().
- */
-static void *stale_follow_link(struct dentry *dent, struct nameidata *nd)
-{
-	return ERR_PTR(vfs_follow_link(nd, ERR_PTR(-ESTALE)));
-}
-
-static int return_ESTALE(void)
-{
-	return -ESTALE;
-}
-
-#define ESTALE_ERROR ((void *) (return_ESTALE))
-
-static struct file_operations stale_file_ops = {
-	.llseek		= ESTALE_ERROR,
-	.read		= ESTALE_ERROR,
-	.write		= ESTALE_ERROR,
-	.readdir	= ESTALE_ERROR,
-	.poll		= ESTALE_ERROR,
-	.ioctl		= ESTALE_ERROR,
-	.mmap		= ESTALE_ERROR,
-	.open		= ESTALE_ERROR,
-	.flush		= ESTALE_ERROR,
-	.release	= ESTALE_ERROR,
-	.fsync		= ESTALE_ERROR,
-	.fasync		= ESTALE_ERROR,
-	.lock		= ESTALE_ERROR,
-};
-
-struct inode_operations stale_inode_ops = {
-	.create		= ESTALE_ERROR,
-	.lookup		= ESTALE_ERROR,
-	.link		= ESTALE_ERROR,
-	.unlink		= ESTALE_ERROR,
-	.symlink	= ESTALE_ERROR,
-	.mkdir		= ESTALE_ERROR,
-	.rmdir		= ESTALE_ERROR,
-	.mknod		= ESTALE_ERROR,
-	.rename		= ESTALE_ERROR,
-	.readlink	= ESTALE_ERROR,
-	.follow_link	= stale_follow_link,
-	.truncate	= ESTALE_ERROR,
-	.permission	= ESTALE_ERROR,
-};
-
-/*
- * When a filesystem is unable to read an inode due to an I/O error in
- * its read_inode() function, it can call make_stale_inode() to return a
- * set of stubs which will return ESTALE errors as required.
- *
- * We only need to do limited initialisation: all other fields are
- * preinitialised to zero automatically.
- */
-
-/**
- * make_stale_inode - mark an inode stale due to an I/O error
- * @inode: Inode to mark stale
- *
- * When an inode cannot be read due to a media or remote network
- * failure this function makes the inode "stale" and causes I/O operations
- * on it to fail from this point on.
- */
-void make_stale_inode(struct inode *inode)
-{
-	inode->i_mode = S_IFREG;
-	inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
-	inode->i_op = &stale_inode_ops;
-	inode->i_fop = &stale_file_ops;
-	inode->i_mapping->a_ops = &unionfs_stale_aops;
-}
-
-/*
- * This tests whether an inode has been flagged as stale. The test uses
- * &stale_inode_ops to cover the case of invalidated inodes as well as
- * those created by make_stale_inode() above.
- */
-
-/**
- * is_stale_inode - is an inode errored
- * @inode: inode to test
- *
- * Returns true if the inode in question has been marked as stale.
- */
-int is_stale_inode(struct inode *inode)
-{
-	return (inode->i_op == &stale_inode_ops);
-}
-
diff --git a/fs/unionfs/union.h b/fs/unionfs/union.h
index b6e03ff..637f9f0 100644
--- a/fs/unionfs/union.h
+++ b/fs/unionfs/union.h
@@ -396,7 +396,6 @@ static inline int unionfs_get_nlinks(struct inode *inode)
 
 struct dentry *unionfs_lookup_backend(struct dentry *dentry, struct nameidata *nd, int lookupmode);
 int is_stale_inode(struct inode *inode);
-void make_stale_inode(struct inode *inode);
 
 #define IS_SET(sb, check_flag) ((check_flag) & MOUNT_FLAG(sb))
 
-- 
1.5.0.rc1.g5355


  reply	other threads:[~2007-01-29 20:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-29 20:37 [GIT PULL -mm] Unionfs updates/cleanups Josef 'Jeff' Sipek
2007-01-29 20:37 ` Josef 'Jeff' Sipek [this message]
2007-01-29 20:37 ` [PATCH 2/4] fs/unionfs/: possible cleanups Josef 'Jeff' Sipek
2007-01-29 20:37 ` [PATCH 3/4] fs/unionfs/: Andrew Morton's comments Josef 'Jeff' Sipek
2007-01-29 20:37 ` [PATCH 4/4] fs/unionfs/: Don't duplicate the struct nameidata Josef 'Jeff' Sipek
2007-01-30  9:42   ` Christoph Hellwig
2007-01-30 17:52     ` Josef Sipek
2007-01-29 20:37 ` Josef 'Jeff' Sipek
2007-01-29 20:40   ` Josef Sipek

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=11701030632165-git-send-email-jsipek@cs.sunysb.edu \
    --to=jsipek@cs.sunysb.edu \
    --cc=akpm@osdl.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.