All of lore.kernel.org
 help / color / mirror / Atom feed
From: npiggin@suse.de
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-fsdevel@vger.kernel.org, Christoph Hellwig <hch@lst.de>
Subject: [patch 04/11] fs: convert simple fs to new truncate
Date: Fri, 21 Aug 2009 02:35:08 +1000	[thread overview]
Message-ID: <20090820164050.891792656@suse.de> (raw)
In-Reply-To: 20090820163504.131529718@suse.de

[-- Attachment #1: fs-simple-new-truncate.patch --]
[-- Type: text/plain, Size: 3289 bytes --]

Convert simple filesystems: ramfs, configfs, sysfs to new truncate sequence.

Signed-off-by: Nick Piggin <npiggin@suse.de>
---
 fs/configfs/inode.c   |   11 ++++++++---
 fs/ramfs/file-mmu.c   |    2 ++
 fs/ramfs/file-nommu.c |    8 +++++---
 fs/sysfs/inode.c      |    7 ++-----
 4 files changed, 17 insertions(+), 11 deletions(-)

Index: linux-2.6/fs/ramfs/file-mmu.c
===================================================================
--- linux-2.6.orig/fs/ramfs/file-mmu.c
+++ linux-2.6/fs/ramfs/file-mmu.c
@@ -50,5 +50,7 @@ const struct file_operations ramfs_file_
 };
 
 const struct inode_operations ramfs_file_inode_operations = {
+	.new_truncate	= 1,
+	.setattr	= simple_setattr,
 	.getattr	= simple_getattr,
 };
Index: linux-2.6/fs/ramfs/file-nommu.c
===================================================================
--- linux-2.6.orig/fs/ramfs/file-nommu.c
+++ linux-2.6/fs/ramfs/file-nommu.c
@@ -48,6 +48,7 @@ const struct file_operations ramfs_file_
 };
 
 const struct inode_operations ramfs_file_inode_operations = {
+	.new_truncate		= 1,
 	.setattr		= ramfs_nommu_setattr,
 	.getattr		= simple_getattr,
 };
@@ -169,7 +170,7 @@ static int ramfs_nommu_resize(struct ino
 			return ret;
 	}
 
-	ret = vmtruncate(inode, newsize);
+	ret = simple_setsize(inode, newsize);
 
 	return ret;
 }
@@ -192,7 +193,8 @@ static int ramfs_nommu_setattr(struct de
 
 	/* pick out size-changing events */
 	if (ia->ia_valid & ATTR_SIZE) {
-		loff_t size = i_size_read(inode);
+		loff_t size = inode->i_size;
+
 		if (ia->ia_size != size) {
 			ret = ramfs_nommu_resize(inode, ia->ia_size, size);
 			if (ret < 0 || ia->ia_valid == ATTR_SIZE)
@@ -205,7 +207,7 @@ static int ramfs_nommu_setattr(struct de
 		}
 	}
 
-	ret = inode_setattr(inode, ia);
+	generic_setattr(inode, ia);
  out:
 	ia->ia_valid = old_ia_valid;
 	return ret;
Index: linux-2.6/fs/configfs/inode.c
===================================================================
--- linux-2.6.orig/fs/configfs/inode.c
+++ linux-2.6/fs/configfs/inode.c
@@ -56,6 +56,7 @@ static struct backing_dev_info configfs_
 };
 
 static const struct inode_operations configfs_inode_operations ={
+	.new_truncate	= 1,
 	.setattr	= configfs_setattr,
 };
 
@@ -76,9 +77,13 @@ int configfs_setattr(struct dentry * den
 	if (error)
 		return error;
 
-	error = inode_setattr(inode, iattr);
-	if (error)
-		return error;
+	if (iattr->ia_valid & ATTR_SIZE) {
+		error = simple_setsize(inode, iattr->ia_size);
+		if (error)
+			return error;
+	}
+
+	generic_setattr(inode, iattr);
 
 	if (!sd_iattr) {
 		/* setting attributes for the first time, allocate now */
Index: linux-2.6/fs/sysfs/inode.c
===================================================================
--- linux-2.6.orig/fs/sysfs/inode.c
+++ linux-2.6/fs/sysfs/inode.c
@@ -34,6 +34,7 @@ static struct backing_dev_info sysfs_bac
 };
 
 static const struct inode_operations sysfs_inode_operations ={
+	.new_truncate	= 1,
 	.setattr	= sysfs_setattr,
 };
 
@@ -59,11 +60,7 @@ int sysfs_setattr(struct dentry * dentry
 	if (error)
 		return error;
 
-	iattr->ia_valid &= ~ATTR_SIZE; /* ignore size changes */
-
-	error = inode_setattr(inode, iattr);
-	if (error)
-		return error;
+	generic_setattr(inode, iattr);
 
 	if (!sd_iattr) {
 		/* setting attributes for the first time, allocate now */



  parent reply	other threads:[~2009-08-20 16:42 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-20 16:35 [patch 00/11] new truncate sequence npiggin
2009-08-20 16:35 ` [patch 01/11] fs: new truncate helpers npiggin
2009-08-26  7:38   ` Artem Bityutskiy
2009-09-07  7:33     ` Nick Piggin
2009-09-07  7:48       ` Artem Bityutskiy
2009-08-20 16:35 ` [patch 02/11] fs: use " npiggin
2009-08-20 16:35   ` npiggin-l3A5Bk7waGM
2009-08-20 16:35 ` [patch 03/11] fs: introduce new truncate sequence npiggin
2009-08-26  7:40   ` Artem Bityutskiy
2009-08-20 16:35 ` npiggin [this message]
2009-08-20 16:35 ` [patch 05/11] tmpfs: convert to use the new truncate convention npiggin
2009-08-20 16:35 ` [patch 06/11] ext2: " npiggin
2009-08-21 13:42   ` Jan Kara
2009-08-21 14:06     ` Jan Kara
2009-08-24  5:30       ` [patch] ext2: convert to use the new truncate convention fix Nick Piggin
2009-08-20 16:35 ` [patch 07/11] fat: convert to use the new truncate convention npiggin
2009-08-20 16:35 ` [patch 08/11] btrfs: " npiggin
2009-08-20 16:35   ` npiggin
2009-08-20 16:35 ` [patch 09/11] jfs: " npiggin
2009-08-20 16:35 ` [patch 10/11] udf: " npiggin
2009-08-21 14:22   ` Jan Kara
2009-08-24  5:33     ` Nick Piggin
2009-08-20 16:35 ` [patch 11/11] minix: " npiggin
2009-09-09  7:11 ` [patch 00/11] new truncate sequence Artem Bityutskiy
2009-09-22 15:04 ` Al Viro
2009-09-22 20:00   ` Christoph Hellwig
2009-09-22 21:51     ` Al Viro
2009-09-22 23:27       ` Al Viro
2009-09-22 23:58         ` Al Viro
2009-09-23  2:29           ` Al Viro
2009-09-27 19:50             ` Nick Piggin
2009-12-07 12:49             ` Nick Piggin
2009-12-07 22:46               ` Tyler Hicks
2009-09-22 20:53 ` [PATCH 12/n] kill spurious reference to vmtruncate Christoph Hellwig
2009-09-22 20:54 ` [PATCH 13/n] xfs: new truncate sequence Christoph Hellwig
2009-09-22 20:54   ` Christoph Hellwig
2009-09-22 20:55 ` [PATCH 14/n] sysv: " Christoph Hellwig
2009-09-22 20:56 ` [PATCH 15/n] ntfs: " Christoph Hellwig

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=20090820164050.891792656@suse.de \
    --to=npiggin@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=hch@lst.de \
    --cc=linux-fsdevel@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.