From: Jan Kara <jack@suse.cz>
To: Dmitry Monakhov <dmonakhov@openvz.org>
Cc: Jan Kara <jack@suse.cz>, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 1/5] Add unlocked version of inode_add_bytes() function
Date: Mon, 14 Dec 2009 18:21:56 +0100 [thread overview]
Message-ID: <20091214172155.GC4731@quack.suse.cz> (raw)
In-Reply-To: <1260793276-8511-1-git-send-email-dmonakhov@openvz.org>
On Mon 14-12-09 15:21:12, Dmitry Monakhov wrote:
> Quota code requires unlocked version of this function. Off course
> we can just copy-paste the code, but copy-pasting is always an evil.
Looks good. Merged into my tree.
Honza
> Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
> ---
> fs/stat.c | 10 ++++++++--
> include/linux/fs.h | 1 +
> 2 files changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/fs/stat.c b/fs/stat.c
> index 075694e..c4ecd52 100644
> --- a/fs/stat.c
> +++ b/fs/stat.c
> @@ -401,9 +401,9 @@ SYSCALL_DEFINE4(fstatat64, int, dfd, char __user *, filename,
> }
> #endif /* __ARCH_WANT_STAT64 */
>
> -void inode_add_bytes(struct inode *inode, loff_t bytes)
> +/* Caller is here responsible for sufficient locking (ie. inode->i_lock) */
> +void __inode_add_bytes(struct inode *inode, loff_t bytes)
> {
> - spin_lock(&inode->i_lock);
> inode->i_blocks += bytes >> 9;
> bytes &= 511;
> inode->i_bytes += bytes;
> @@ -411,6 +411,12 @@ void inode_add_bytes(struct inode *inode, loff_t bytes)
> inode->i_blocks++;
> inode->i_bytes -= 512;
> }
> +}
> +
> +void inode_add_bytes(struct inode *inode, loff_t bytes)
> +{
> + spin_lock(&inode->i_lock);
> + __inode_add_bytes(inode, bytes);
> spin_unlock(&inode->i_lock);
> }
>
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 2620a8c..98ea200 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -2314,6 +2314,7 @@ extern const struct inode_operations page_symlink_inode_operations;
> extern int generic_readlink(struct dentry *, char __user *, int);
> extern void generic_fillattr(struct inode *, struct kstat *);
> extern int vfs_getattr(struct vfsmount *, struct dentry *, struct kstat *);
> +void __inode_add_bytes(struct inode *inode, loff_t bytes);
> void inode_add_bytes(struct inode *inode, loff_t bytes);
> void inode_sub_bytes(struct inode *inode, loff_t bytes);
> loff_t inode_get_bytes(struct inode *inode);
> --
> 1.6.0.4
>
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
prev parent reply other threads:[~2009-12-14 17:55 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-14 12:21 [PATCH 1/5] Add unlocked version of inode_add_bytes() function Dmitry Monakhov
2009-12-14 12:21 ` [PATCH 2/5] quota: decouple fs reserved space from quota reservation. [V5] Dmitry Monakhov
2009-12-14 12:21 ` [PATCH 3/5] ext4: Convert to generic reserved quota's space management. [V5] Dmitry Monakhov
2009-12-14 12:21 ` [PATCH 4/5] quota: Move duplicated code to separate functions Dmitry Monakhov
2009-12-14 12:21 ` [PATCH 5/5] quota: handle IO errors in dquot_transfer() Dmitry Monakhov
2009-12-14 18:41 ` Jan Kara
2009-12-14 22:43 ` Dmitry Monakhov
2009-12-15 11:49 ` Jan Kara
2009-12-14 18:00 ` [PATCH 4/5] quota: Move duplicated code to separate functions Jan Kara
2009-12-14 14:35 ` [PATCH 3/5] ext4: Convert to generic reserved quota's space management. [V5] tytso
2009-12-14 17:26 ` Jan Kara
2009-12-14 17:25 ` Jan Kara
2009-12-14 17:24 ` [PATCH 2/5] quota: decouple fs reserved space from quota reservation. [V5] Jan Kara
2009-12-14 17:21 ` Jan Kara [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=20091214172155.GC4731@quack.suse.cz \
--to=jack@suse.cz \
--cc=dmonakhov@openvz.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).