All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: npiggin@suse.de
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-fsdevel@vger.kernel.org, Christoph Hellwig <hch@lst.de>
Subject: [PATCH 15/n] ntfs: new truncate sequence
Date: Tue, 22 Sep 2009 16:56:50 -0400	[thread overview]
Message-ID: <20090922205650.GD12224@infradead.org> (raw)
In-Reply-To: <20090820163504.131529718@suse.de>

The ntfs code isa a bit weird in it's truncate code, so just convert it
to use simple_setsize and leave the rest to someone who knows it better.


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

Index: vfs-2.6.git/fs/ntfs/aops.c
===================================================================
--- vfs-2.6.git.orig/fs/ntfs/aops.c	2009-09-22 15:42:33.666298178 -0300
+++ vfs-2.6.git/fs/ntfs/aops.c	2009-09-22 15:42:44.701761705 -0300
@@ -642,7 +642,7 @@ static int ntfs_write_block(struct page 
 			 * FIXME: What about the small race window where
 			 * ntfs_writepage() has not done any clearing because
 			 * the page was within i_size but before we get here,
-			 * vmtruncate() modifies i_size?
+			 * truncate modifies i_size?
 			 */
 			clear_buffer_dirty(bh);
 			set_buffer_uptodate(bh);
Index: vfs-2.6.git/fs/ntfs/file.c
===================================================================
--- vfs-2.6.git.orig/fs/ntfs/file.c	2009-09-22 15:41:58.526264375 -0300
+++ vfs-2.6.git/fs/ntfs/file.c	2009-09-22 15:46:05.890266938 -0300
@@ -2039,7 +2039,7 @@ static ssize_t ntfs_file_buffered_write(
 				 */
 				i_size = i_size_read(vi);
 				if (pos + bytes > i_size)
-					vmtruncate(vi, i_size);
+					ntfs_truncate(inode);
 				break;
 			}
 		}
@@ -2278,7 +2278,7 @@ const struct file_operations ntfs_file_o
 
 const struct inode_operations ntfs_file_inode_ops = {
 #ifdef NTFS_RW
-	.truncate	= ntfs_truncate_vfs,
+	.truncate_kludge_to_be_killed = 1,
 	.setattr	= ntfs_setattr,
 #endif /* NTFS_RW */
 };
Index: vfs-2.6.git/fs/ntfs/inode.c
===================================================================
--- vfs-2.6.git.orig/fs/ntfs/inode.c	2009-09-22 15:39:44.429764137 -0300
+++ vfs-2.6.git/fs/ntfs/inode.c	2009-09-22 15:47:54.481767325 -0300
@@ -2348,11 +2348,7 @@ static const char *es = "  Leaving incon
  * Returns 0 on success or -errno on error.
  *
  * Called with ->i_mutex held.  In all but one case ->i_alloc_sem is held for
- * writing.  The only case in the kernel where ->i_alloc_sem is not held is
- * mm/filemap.c::generic_file_buffered_write() where vmtruncate() is called
- * with the current i_size as the offset.  The analogous place in NTFS is in
- * fs/ntfs/file.c::ntfs_file_buffered_write() where we call vmtruncate() again
- * without holding ->i_alloc_sem.
+ * writing.  That case is in fs/ntfs/file.c::ntfs_file_buffered_write().
  */
 int ntfs_truncate(struct inode *vi)
 {
@@ -2506,7 +2502,7 @@ retry_truncate:
 		/*
 		 * Note ntfs_resident_attr_value_resize() has already done any
 		 * necessary data clearing in the attribute record.  When the
-		 * file is being shrunk vmtruncate() will already have cleared
+		 * file is being shrunk truncate will already have cleared
 		 * the top part of the last partial page, i.e. since this is
 		 * the resident case this is the page with index 0.  However,
 		 * when the file is being expanded, the page cache page data
@@ -2854,18 +2850,6 @@ conv_err_out:
 }
 
 /**
- * ntfs_truncate_vfs - wrapper for ntfs_truncate() that has no return value
- * @vi:		inode for which the i_size was changed
- *
- * Wrapper for ntfs_truncate() that has no return value.
- *
- * See ntfs_truncate() description above for details.
- */
-void ntfs_truncate_vfs(struct inode *vi) {
-	ntfs_truncate(vi);
-}
-
-/**
  * ntfs_setattr - called from notify_change() when an attribute is being changed
  * @dentry:	dentry whose attributes to change
  * @attr:	structure describing the attributes and the changes
@@ -2913,8 +2897,13 @@ int ntfs_setattr(struct dentry *dentry, 
 						NInoCompressed(ni) ?
 						"compressed" : "encrypted");
 				err = -EOPNOTSUPP;
-			} else
-				err = vmtruncate(vi, attr->ia_size);
+				goto out;
+			}
+
+			err = simple_setsize(inode, attr->ia_size);
+			if (err)
+				goto out;
+			err = ntfs_truncate(inode);
 			if (err || ia_valid == ATTR_SIZE)
 				goto out;
 		} else {
Index: vfs-2.6.git/fs/ntfs/inode.h
===================================================================
--- vfs-2.6.git.orig/fs/ntfs/inode.h	2009-09-22 15:43:39.293762634 -0300
+++ vfs-2.6.git/fs/ntfs/inode.h	2009-09-22 15:43:48.061766513 -0300
@@ -303,7 +303,6 @@ extern int ntfs_show_options(struct seq_
 #ifdef NTFS_RW
 
 extern int ntfs_truncate(struct inode *vi);
-extern void ntfs_truncate_vfs(struct inode *vi);
 
 extern int ntfs_setattr(struct dentry *dentry, struct iattr *attr);
 

      parent reply	other threads:[~2009-09-22 20:56 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 ` [patch 04/11] fs: convert simple fs to new truncate npiggin
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 ` Christoph Hellwig [this message]

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=20090922205650.GD12224@infradead.org \
    --to=hch@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=hch@lst.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=npiggin@suse.de \
    /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.