All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Halcrow <mhalcrow@us.ibm.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	Christoph Hellwig <hch@infradead.org>,
	Mike Halcrow <mhalcrow@us.ibm.com>,
	Mike Halcrow <mike@halcrow.us>
Subject: [PATCH 7/10] Remove extraneous read of inode size from header
Date: Fri, 26 May 2006 09:21:48 -0500	[thread overview]
Message-ID: <E1FjdCG-00033d-N5@localhost.localdomain> (raw)
In-Reply-To: <20060526142117.GA2764@us.ibm.com>

Christoph Hellwig pointed out that the inode is not live at this point
in ecryptfs_open(), and so this entire function is pointless.

Signed-off-by: Michael Halcrow <mhalcrow@us.ibm.com>

---

 fs/ecryptfs/file.c |   47 +----------------------------------------------
 1 files changed, 1 insertions(+), 46 deletions(-)

35776954e1116224272c4e191aed9a85b63914f7
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c
index 0284e16..b8fcd0a 100644
--- a/fs/ecryptfs/file.c
+++ b/fs/ecryptfs/file.c
@@ -189,49 +189,6 @@ retry:
 	return rc;
 }
 
-/**
- * read_inode_size_from_header
- * @lower_file: The lower file struct
- * @lower_inode: The lower inode
- * @inode: The ecryptfs inode
- *
- * Returns zero on success; non-zero otherwise
- */
-static int
-read_inode_size_from_header(struct file *lower_file,
-			    struct inode *lower_inode, struct inode *inode)
-{
-	int rc;
-	struct page *header_page;
-	unsigned char *header_virt;
-	u64 data_size;
-
-	header_page = grab_cache_page(lower_inode->i_mapping, 0);
-	if (!header_page) {
-		rc = -EINVAL;
-		ecryptfs_printk(KERN_ERR, "grab_cache_page for header page "
-				"failed\n");
-		goto out;
-	}
-	header_virt = kmap(header_page);
-	rc = lower_inode->i_mapping->a_ops->readpage(lower_file, header_page);
-	if (rc) {
-		ecryptfs_printk(KERN_ERR, "Error reading header page\n");
-		goto out_unmap;
-	}
-	memcpy(&data_size, header_virt, sizeof(data_size));
-	data_size = be64_to_cpu(data_size);
-	i_size_write(inode, (loff_t)data_size);
-	ecryptfs_printk(KERN_DEBUG, "inode w/ addr = [0x%p], i_ino = [0x%.16x] "
-			"size: [0x%.16x]\n", inode, inode->i_ino,
-			i_size_read(inode));
-out_unmap:
-	kunmap(header_page);
-	page_cache_release(header_page);
-out:
-	return rc;
-}
-
 struct kmem_cache *ecryptfs_file_info_cache;
 
 /**
@@ -320,9 +277,7 @@ static int ecryptfs_open(struct inode *i
 			 * going to default to -EIO. */
 			rc = -EIO;
 			goto out_puts;
-		} else
-			read_inode_size_from_header(lower_file, lower_inode,
-						    inode);
+		}
 	}
 	ecryptfs_printk(KERN_DEBUG, "inode w/ addr = [0x%p], i_ino = [0x%.16x] "
 			"size: [0x%.16x]\n", inode, inode->i_ino,
-- 
1.3.3


  reply	other threads:[~2006-05-26 14:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-26 14:21 [PATCH 0/10] eCryptfs Updates Michael Halcrow
2006-05-26 14:21 ` Mike Halcrow [this message]
2006-05-26 14:21 ` [PATCH 5/10] Remove unnecessary #ifndef's Mike Halcrow
2006-05-26 14:21 ` [PATCH 1/10] Convert ASSERT to BUG_ON Mike Halcrow
2006-05-26 15:24   ` Adrian Bunk
2006-05-26 16:14     ` Michael Halcrow
2006-05-26 16:43       ` Adrian Bunk
2006-05-26 18:39     ` [PATCH] Remove ECRYPT_DEBUG from fs/Kconfig Michael Halcrow
2006-05-26 14:21 ` [PATCH 2/10] Clean up #include's Mike Halcrow
2006-05-26 14:21 ` [PATCH 9/10] Rewrite ecryptfs_fsync() Mike Halcrow
2006-05-26 14:21 ` [PATCH 6/10] Remove ``NULL =='' syntax Mike Halcrow
2006-05-26 14:21 ` [PATCH 8/10] Remove unnecessary NULL checks Mike Halcrow
2006-05-26 14:21 ` [PATCH 10/10] Overhaul file locking Mike Halcrow
2006-05-26 14:21 ` [PATCH 3/10] Convert signed data types to unsigned data types Mike Halcrow
2006-05-26 14:21 ` [PATCH 4/10] uint16_t -> u16 Mike Halcrow

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=E1FjdCG-00033d-N5@localhost.localdomain \
    --to=mhalcrow@us.ibm.com \
    --cc=akpm@osdl.org \
    --cc=hch@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mike@halcrow.us \
    /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.