From: Christoph Hellwig <hch@infradead.org>
To: Nick Piggin <npiggin@suse.de>
Cc: linux-fsdevel@vger.kernel.org,
Christoph Hellwig <hch@infradead.org>, Jan Kara <jack@suse.cz>,
LKML <linux-kernel@vger.kernel.org>,
linux-mm@kvack.org
Subject: Re: [rfc][patch 3/4] fs: new truncate sequence
Date: Tue, 7 Jul 2009 10:58:20 -0400 [thread overview]
Message-ID: <20090707145820.GA9976@infradead.org> (raw)
In-Reply-To: <20090707144823.GE2714@wotan.suse.de>
On Tue, Jul 07, 2009 at 04:48:23PM +0200, Nick Piggin wrote:
> Don't know whether it is a good idea to move i_alloc_sem into implementation.
> Maybe it is better to leave it in the caller in this patchset?
Generally moving locks without changing prototypes can be a very subtle
way to break things. A good option is to move the locking in a separate
patch set in a patch series or at least release if it's otherwise to
complicated.
> +int simple_setsize(struct dentry *dentry, loff_t newsize,
> + unsigned flags, struct file *file)
This one could probably also use kerneldoc comment.
> +{
> + struct inode *inode = dentry->d_inode;
> + loff_t oldsize;
> + int error;
> +
> + error = inode_newsize_ok(inode, newsize);
> + if (error)
> + return error;
> +
> + oldsize = inode->i_size;
> + i_size_write(inode, newsize);
> + truncate_pagecache(inode, oldsize, newsize);
> +
> + return error;
> +}
> + if (ia_valid & ATTR_SIZE) {
> + if (inode->i_op && inode->i_op->setsize) {
inode->i_op is mandatory these days.
> + unsigned int flags = 0;
> + struct file *file = NULL;
> +
> + if (ia_valid & ATTR_FILE) {
> + flags |= SETSIZE_FILE;
> + file = attr->ia_file;
> + }
> + if (ia_valid & ATTR_OPEN)
> + flags |= SETSIZE_OPEN;
> + error = inode->i_op->setsize(dentry, attr->ia_size,
> + flags, file);
> + if (error)
> + return error;
So you still pass down to ->setattr if ->setsize succeeded? That's a
very confusing calling convention. It also means we first do the
truncation and any following time/mode updates are in a separate
transaction which is a no-go.
WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch@infradead.org>
To: Nick Piggin <npiggin@suse.de>
Cc: linux-fsdevel@vger.kernel.org,
Christoph Hellwig <hch@infradead.org>, Jan Kara <jack@suse.cz>,
LKML <linux-kernel@vger.kernel.org>,
linux-mm@kvack.org
Subject: Re: [rfc][patch 3/4] fs: new truncate sequence
Date: Tue, 7 Jul 2009 10:58:20 -0400 [thread overview]
Message-ID: <20090707145820.GA9976@infradead.org> (raw)
In-Reply-To: <20090707144823.GE2714@wotan.suse.de>
On Tue, Jul 07, 2009 at 04:48:23PM +0200, Nick Piggin wrote:
> Don't know whether it is a good idea to move i_alloc_sem into implementation.
> Maybe it is better to leave it in the caller in this patchset?
Generally moving locks without changing prototypes can be a very subtle
way to break things. A good option is to move the locking in a separate
patch set in a patch series or at least release if it's otherwise to
complicated.
> +int simple_setsize(struct dentry *dentry, loff_t newsize,
> + unsigned flags, struct file *file)
This one could probably also use kerneldoc comment.
> +{
> + struct inode *inode = dentry->d_inode;
> + loff_t oldsize;
> + int error;
> +
> + error = inode_newsize_ok(inode, newsize);
> + if (error)
> + return error;
> +
> + oldsize = inode->i_size;
> + i_size_write(inode, newsize);
> + truncate_pagecache(inode, oldsize, newsize);
> +
> + return error;
> +}
> + if (ia_valid & ATTR_SIZE) {
> + if (inode->i_op && inode->i_op->setsize) {
inode->i_op is mandatory these days.
> + unsigned int flags = 0;
> + struct file *file = NULL;
> +
> + if (ia_valid & ATTR_FILE) {
> + flags |= SETSIZE_FILE;
> + file = attr->ia_file;
> + }
> + if (ia_valid & ATTR_OPEN)
> + flags |= SETSIZE_OPEN;
> + error = inode->i_op->setsize(dentry, attr->ia_size,
> + flags, file);
> + if (error)
> + return error;
So you still pass down to ->setattr if ->setsize succeeded? That's a
very confusing calling convention. It also means we first do the
truncation and any following time/mode updates are in a separate
transaction which is a no-go.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2009-07-07 14:58 UTC|newest]
Thread overview: 72+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-07 14:44 [rfc][patch 1/4] fs: new truncate helpers Nick Piggin
2009-07-07 14:44 ` Nick Piggin
2009-07-07 14:46 ` [rfc][patch 2/4] fs: use " Nick Piggin
2009-07-07 14:46 ` Nick Piggin
2009-07-07 14:53 ` Christoph Hellwig
2009-07-07 14:53 ` Christoph Hellwig
2009-07-07 14:48 ` [rfc][patch 3/4] fs: new truncate sequence Nick Piggin
2009-07-07 14:48 ` Nick Piggin
2009-07-07 14:58 ` Christoph Hellwig [this message]
2009-07-07 14:58 ` Christoph Hellwig
2009-07-07 15:02 ` Nick Piggin
2009-07-07 15:02 ` Nick Piggin
2009-07-07 15:07 ` Christoph Hellwig
2009-07-07 15:07 ` Christoph Hellwig
2009-07-07 15:48 ` Nick Piggin
2009-07-07 15:48 ` Nick Piggin
2009-07-07 16:30 ` Christoph Hellwig
2009-07-07 16:30 ` Christoph Hellwig
2009-07-08 6:32 ` Nick Piggin
2009-07-08 6:32 ` Nick Piggin
2009-07-08 10:47 ` Christoph Hellwig
2009-07-08 10:47 ` Christoph Hellwig
2009-07-08 12:34 ` Nick Piggin
2009-07-08 12:34 ` Nick Piggin
2009-07-08 12:40 ` Christoph Hellwig
2009-07-08 12:40 ` Christoph Hellwig
2009-07-08 12:48 ` Nick Piggin
2009-07-08 12:48 ` Nick Piggin
2009-07-08 16:07 ` Boaz Harrosh
2009-07-08 16:07 ` Boaz Harrosh
2009-07-09 7:51 ` Nick Piggin
2009-07-09 7:51 ` Nick Piggin
2009-07-12 8:55 ` Boaz Harrosh
2009-07-12 8:55 ` Boaz Harrosh
2009-07-12 14:47 ` Christoph Hellwig
2009-07-12 14:47 ` Christoph Hellwig
2009-07-12 15:00 ` Boaz Harrosh
2009-07-12 15:00 ` Boaz Harrosh
2009-07-13 6:59 ` Nick Piggin
2009-07-13 6:59 ` Nick Piggin
2009-07-13 8:54 ` Boaz Harrosh
2009-07-13 8:54 ` Boaz Harrosh
2009-07-13 9:00 ` Nick Piggin
2009-07-13 9:00 ` Nick Piggin
2009-07-13 11:17 ` Boaz Harrosh
2009-07-13 11:17 ` Boaz Harrosh
2009-07-13 11:32 ` Nick Piggin
2009-07-13 11:32 ` Nick Piggin
2009-07-13 13:53 ` Christoph Hellwig
2009-07-13 13:53 ` Christoph Hellwig
2009-07-13 14:05 ` Nick Piggin
2009-07-13 14:05 ` Nick Piggin
2009-07-13 14:10 ` Christoph Hellwig
2009-07-13 14:10 ` Christoph Hellwig
2009-07-07 14:48 ` [rfc][patch 1/4] fs: new truncate helpers Christoph Hellwig
2009-07-07 14:48 ` Christoph Hellwig
2009-07-07 14:49 ` [rfc][patch 4/4] fs: tmpfs, ext2 use new truncate Nick Piggin
2009-07-07 14:49 ` Nick Piggin
2009-07-07 16:38 ` Christoph Hellwig
2009-07-07 16:38 ` Christoph Hellwig
2009-07-08 6:53 ` Nick Piggin
2009-07-08 6:53 ` Nick Piggin
2009-07-08 11:14 ` Jan Kara
2009-07-08 11:14 ` Jan Kara
2009-07-08 12:22 ` Nick Piggin
2009-07-08 12:22 ` Nick Piggin
2009-07-08 12:32 ` Christoph Hellwig
2009-07-08 12:32 ` Christoph Hellwig
2009-07-08 12:39 ` Nick Piggin
2009-07-08 12:39 ` Nick Piggin
2009-07-08 13:49 ` Christoph Hellwig
2009-07-08 13:49 ` 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=20090707145820.GA9976@infradead.org \
--to=hch@infradead.org \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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.