From: Jan Kara <jack@suse.cz>
To: Dmitry Monakhov <dmonakhov@openvz.org>
Cc: linux-ext4@vger.kernel.org, aneesh.kumar@linux.vnet.ibm.com,
jack@suse.cz, cmm@us.ibm.com
Subject: Re: [PATCH 2/2] ext4: Convert to generic reserved quota's space management. [V3]
Date: Thu, 10 Dec 2009 16:03:31 +0100 [thread overview]
Message-ID: <20091210150331.GD3696@quack.suse.cz> (raw)
In-Reply-To: <1260447952-6201-2-git-send-email-dmonakhov@openvz.org>
On Thu 10-12-09 15:25:52, Dmitry Monakhov wrote:
> This patch fix write vs chown race condition.
>
> Changes from V2:
> -add missed i_reserved_quota iniatilization.diff
>
> Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Looks OK except for the qsize_t* coding style thing...
Honza
> ---
> fs/ext4/ext4.h | 6 +++++-
> fs/ext4/inode.c | 16 +++++++---------
> fs/ext4/super.c | 3 +++
> 3 files changed, 15 insertions(+), 10 deletions(-)
>
> diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
> index 26d3cf8..992cecd 100644
> --- a/fs/ext4/ext4.h
> +++ b/fs/ext4/ext4.h
> @@ -705,6 +705,10 @@ struct ext4_inode_info {
> struct list_head i_aio_dio_complete_list;
> /* current io_end structure for async DIO write*/
> ext4_io_end_t *cur_aio_dio;
> +#ifdef CONFIG_QUOTA
> + /* quota space reservation, managed internally by quota code */
> + qsize_t i_reserved_quota;
> +#endif
> };
>
> /*
> @@ -1427,7 +1431,7 @@ extern int ext4_chunk_trans_blocks(struct inode *, int nrblocks);
> extern int ext4_block_truncate_page(handle_t *handle,
> struct address_space *mapping, loff_t from);
> extern int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf);
> -extern qsize_t ext4_get_reserved_space(struct inode *inode);
> +extern qsize_t* ext4_get_reserved_space(struct inode *inode);
> extern int flush_aio_dio_completed_IO(struct inode *inode);
> /* ioctl.c */
> extern long ext4_ioctl(struct file *, unsigned int, unsigned long);
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index f693768..7fa6db6 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -1048,17 +1048,12 @@ out:
> return err;
> }
>
> -qsize_t ext4_get_reserved_space(struct inode *inode)
> +#ifdef CONFIG_QUOTA
> +qsize_t* ext4_get_reserved_space(struct inode *inode)
> {
> - unsigned long long total;
> -
> - spin_lock(&EXT4_I(inode)->i_block_reservation_lock);
> - total = EXT4_I(inode)->i_reserved_data_blocks +
> - EXT4_I(inode)->i_reserved_meta_blocks;
> - spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
> -
> - return (total << inode->i_blkbits);
> + return &EXT4_I(inode)->i_reserved_quota;
> }
> +#endif
> /*
> * Calculate the number of metadata blocks need to reserve
> * to allocate @blocks for non extent file based file
> @@ -5046,6 +5041,9 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
> ((__u64)le16_to_cpu(raw_inode->i_file_acl_high)) << 32;
> inode->i_size = ext4_isize(raw_inode);
> ei->i_disksize = inode->i_size;
> +#ifdef CONFIG_QUOTA
> + ei->i_reserved_quota = 0;
> +#endif
> inode->i_generation = le32_to_cpu(raw_inode->i_generation);
> ei->i_block_group = iloc.block_group;
> ei->i_last_alloc_group = ~0;
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 4c87d97..4697272 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -713,6 +713,9 @@ static struct inode *ext4_alloc_inode(struct super_block *sb)
> spin_lock_init(&(ei->i_block_reservation_lock));
> INIT_LIST_HEAD(&ei->i_aio_dio_complete_list);
> ei->cur_aio_dio = NULL;
> +#ifdef CONFIG_QUOTA
> + ei->i_reserved_quota = 0;
> +#endif
>
> return &ei->vfs_inode;
> }
> --
> 1.6.0.4
>
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
next prev parent reply other threads:[~2009-12-11 20:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-10 12:25 [PATCH 1/2] quota: decouple fs reserved space from quota reservation. [V3] Dmitry Monakhov
2009-12-10 12:25 ` [PATCH 2/2] ext4: Convert to generic reserved quota's space management. [V3] Dmitry Monakhov
2009-12-10 15:03 ` Jan Kara [this message]
2009-12-10 15:02 ` [PATCH 1/2] quota: decouple fs reserved space from quota reservation. [V3] Jan Kara
2009-12-14 12:45 ` Dmitry Monakhov
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=20091210150331.GD3696@quack.suse.cz \
--to=jack@suse.cz \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=cmm@us.ibm.com \
--cc=dmonakhov@openvz.org \
--cc=linux-ext4@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 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.