All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: viro@zeniv.linux.org.uk, npiggin@suse.de
Cc: jack@suse.cz, linux-fsdevel@vger.kernel.org
Subject: [PATCH 1/4] add missing setattr methods
Date: Mon, 31 May 2010 11:40:04 +0200	[thread overview]
Message-ID: <20100531094004.GA10001@lst.de> (raw)
In-Reply-To: <20100531093954.GA9946@lst.de>

For the new truncate sequence every filesystem that wants to truncate on-disk
state needs a seattr method.  Convert the remaining filesystems that implement
the truncate inode operation to have it's own setattr method.

Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: linux-2.6/fs/hfsplus/inode.c
===================================================================
--- linux-2.6.orig/fs/hfsplus/inode.c	2010-05-30 23:27:41.305253681 +0200
+++ linux-2.6/fs/hfsplus/inode.c	2010-05-30 23:27:48.000000000 +0200
@@ -290,9 +290,21 @@ static int hfsplus_file_release(struct i
 	return 0;
 }
 
+static int hfsplus_setattr(struct dentry *dentry, struct iattr *attr)
+{
+	struct inode *inode = dentry->d_inode;
+	int error;
+
+	error = inode_change_ok(inode, attr);
+	if (error)
+		return error;
+	return inode_setattr(inode, attr);
+}
+
 static const struct inode_operations hfsplus_file_inode_operations = {
 	.lookup		= hfsplus_file_lookup,
 	.truncate	= hfsplus_file_truncate,
+	.setattr	= hfsplus_setattr,
 	.setxattr	= hfsplus_setxattr,
 	.getxattr	= hfsplus_getxattr,
 	.listxattr	= hfsplus_listxattr,
Index: linux-2.6/fs/minix/file.c
===================================================================
--- linux-2.6.orig/fs/minix/file.c	2010-05-30 22:27:14.761016568 +0200
+++ linux-2.6/fs/minix/file.c	2010-05-30 23:27:48.000000000 +0200
@@ -23,7 +23,19 @@ const struct file_operations minix_file_
 	.splice_read	= generic_file_splice_read,
 };
 
+static int minix_setattr(struct dentry *dentry, struct iattr *attr)
+{
+	struct inode *inode = dentry->d_inode;
+	int error;
+
+	error = inode_change_ok(inode, attr);
+	if (error)
+		return error;
+	return inode_setattr(inode, attr);
+}
+
 const struct inode_operations minix_file_inode_operations = {
 	.truncate	= minix_truncate,
+	.setattr	= minix_setattr,
 	.getattr	= minix_getattr,
 };
Index: linux-2.6/fs/omfs/file.c
===================================================================
--- linux-2.6.orig/fs/omfs/file.c	2010-05-30 23:27:45.963253961 +0200
+++ linux-2.6/fs/omfs/file.c	2010-05-30 23:27:48.000000000 +0200
@@ -341,7 +341,19 @@ const struct file_operations omfs_file_o
 	.splice_read = generic_file_splice_read,
 };
 
+static int omfs_setattr(struct dentry *dentry, struct iattr *attr)
+{
+	struct inode *inode = dentry->d_inode;
+	int error;
+
+	error = inode_change_ok(inode, attr);
+	if (error)
+		return error;
+	return inode_setattr(inode, attr);
+}
+
 const struct inode_operations omfs_file_inops = {
+	.setattr = omfs_setattr,
 	.truncate = omfs_truncate
 };
 
Index: linux-2.6/fs/sysv/file.c
===================================================================
--- linux-2.6.orig/fs/sysv/file.c	2010-05-30 22:27:14.730255707 +0200
+++ linux-2.6/fs/sysv/file.c	2010-05-30 23:27:48.000000000 +0200
@@ -30,7 +30,19 @@ const struct file_operations sysv_file_o
 	.splice_read	= generic_file_splice_read,
 };
 
+static int sysv_setattr(struct dentry *dentry, struct iattr *attr)
+{
+	struct inode *inode = dentry->d_inode;
+	int error;
+
+	error = inode_change_ok(inode, attr);
+	if (error)
+		return error;
+	return inode_setattr(inode, attr);
+}
+
 const struct inode_operations sysv_file_inode_operations = {
 	.truncate	= sysv_truncate,
+	.setattr	= sysv_setattr,
 	.getattr	= sysv_getattr,
 };
Index: linux-2.6/fs/udf/file.c
===================================================================
--- linux-2.6.orig/fs/udf/file.c	2010-05-31 08:43:43.475253891 +0200
+++ linux-2.6/fs/udf/file.c	2010-05-31 08:44:11.428301463 +0200
@@ -228,6 +228,18 @@ const struct file_operations udf_file_op
 	.llseek			= generic_file_llseek,
 };
 
+static int udf_setattr(struct dentry *dentry, struct iattr *attr)
+{
+	struct inode *inode = dentry->d_inode;
+	int error;
+
+	error = inode_change_ok(inode, attr);
+	if (error)
+		return error;
+	return inode_setattr(inode, attr);
+}
+
 const struct inode_operations udf_file_inode_operations = {
+	.setattr		= udf_setattr,
 	.truncate		= udf_truncate,
 };

  reply	other threads:[~2010-05-31  9:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-31  9:39 [PATCH 0/4] second batch of new truncate sequence preparations Christoph Hellwig
2010-05-31  9:40 ` Christoph Hellwig [this message]
2010-05-31  9:40 ` [PATCH 2/4] rename generic_setattr Christoph Hellwig
2010-05-31  9:40 ` [PATCH 3/4] default to simple_setattr Christoph Hellwig
2010-05-31  9:40 ` [PATCH 4/4] remove inode_setattr Christoph Hellwig
2010-05-31 10:36   ` Boaz Harrosh
2010-05-31 14:04   ` Nick Piggin
2010-05-31 14:08     ` 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=20100531094004.GA10001@lst.de \
    --to=hch@lst.de \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=npiggin@suse.de \
    --cc=viro@zeniv.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 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.