From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Subject: [PATCH 1/4] add missing setattr methods Date: Mon, 31 May 2010 11:40:04 +0200 Message-ID: <20100531094004.GA10001@lst.de> References: <20100531093954.GA9946@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: jack@suse.cz, linux-fsdevel@vger.kernel.org To: viro@zeniv.linux.org.uk, npiggin@suse.de Return-path: Received: from verein.lst.de ([213.95.11.210]:49672 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756529Ab0EaJkF (ORCPT ); Mon, 31 May 2010 05:40:05 -0400 Content-Disposition: inline In-Reply-To: <20100531093954.GA9946@lst.de> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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 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, };