reiserfs-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Edward Shishkin <edward.shishkin@gmail.com>
To: Ivan Shapovalov <intelfx100@gmail.com>
Cc: reiserfs-devel@vger.kernel.org
Subject: Re: [PATCH 3/3] reiser4: do not mess with grab_enabled; instead, use BA_FORCE.
Date: Sat, 18 Oct 2014 19:48:32 +0200	[thread overview]
Message-ID: <5442A7F0.40902@gmail.com> (raw)
In-Reply-To: <1408371283-1319-4-git-send-email-intelfx100@gmail.com>

On 08/18/2014 04:14 PM, Ivan Shapovalov wrote:
> Signed-off-by: Ivan Shapovalov <intelfx100@gmail.com>
> ---
>   fs/reiser4/plugin/file/file.c            | 12 ++++--------
>   fs/reiser4/plugin/file/file_conversion.c |  3 +--
>   fs/reiser4/plugin/file/tail_conversion.c | 11 +++++------
>   fs/reiser4/plugin/item/extent_file_ops.c |  3 +--
>   fs/reiser4/plugin/item/tail.c            |  3 +--
>   fs/reiser4/safe_link.c                   |  4 +---
>   6 files changed, 13 insertions(+), 23 deletions(-)
>
> diff --git a/fs/reiser4/plugin/file/file.c b/fs/reiser4/plugin/file/file.c
> index 94029cd..b0bfa86 100644
> --- a/fs/reiser4/plugin/file/file.c
> +++ b/fs/reiser4/plugin/file/file.c
> @@ -335,11 +335,10 @@ static int find_file_state(struct inode *inode, struct unix_file_info *uf_info)
>    */
>   static int reserve_partial_page(reiser4_tree * tree)
>   {
> -	grab_space_enable();
>   	return reiser4_grab_reserved(reiser4_get_current_sb(),
>   				     1 +
>   				     2 * estimate_one_insert_into_item(tree),
> -				     BA_CAN_COMMIT);
> +				     BA_CAN_COMMIT | BA_FORCE);
>   }
>   
>   /* estimate and reserve space needed to cut one item and update one stat data */
> @@ -350,11 +349,10 @@ static int reserve_cut_iteration(reiser4_tree * tree)
>   
>   	assert("nikita-3172", lock_stack_isclean(get_current_lock_stack()));
>   
> -	grab_space_enable();
>   	/* We need to double our estimate now that we can delete more than one
>   	   node. */
>   	return reiser4_grab_reserved(reiser4_get_current_sb(), estimate * 2,
> -				     BA_CAN_COMMIT);
> +				     BA_CAN_COMMIT | BA_FORCE);
>   }
>   
>   int reiser4_update_file_size(struct inode *inode, loff_t new_size,
> @@ -875,10 +873,9 @@ static int capture_page_and_create_extent(struct page *page)
>   	/* page capture may require extent creation (if it does not exist yet)
>   	   and stat data's update (number of blocks changes on extent
>   	   creation) */
> -	grab_space_enable();
>   	result = reiser4_grab_space(2 * estimate_one_insert_into_item
>   				    (reiser4_tree_by_inode(inode)),
> -				    BA_CAN_COMMIT);
> +				    BA_CAN_COMMIT | BA_FORCE);
>   	if (likely(!result))
>   		result = find_or_create_extent(page);
>   
> @@ -2421,9 +2418,8 @@ static int unpack(struct file *filp, struct inode *inode, int forever)
>   
>   		set_file_notail(inode);
>   
> -		grab_space_enable();
>   		tograb = inode_file_plugin(inode)->estimate.update(inode);
> -		result = reiser4_grab_space(tograb, BA_CAN_COMMIT);
> +		result = reiser4_grab_space(tograb, BA_CAN_COMMIT | BA_FORCE);
>   		result = reiser4_update_sd(inode);
>   	}
>   
> diff --git a/fs/reiser4/plugin/file/file_conversion.c b/fs/reiser4/plugin/file/file_conversion.c
> index 3ce4898..e01720f 100644
> --- a/fs/reiser4/plugin/file/file_conversion.c
> +++ b/fs/reiser4/plugin/file/file_conversion.c
> @@ -388,14 +388,13 @@ static int reserve_cryptcompress2unixfile(struct inode *inode)
>   	 *     5. possible update of stat-data
>   	 *
>   	 */
> -	grab_space_enable();
>   	return reiser4_grab_space
>   		(2 * tree->height +
>   		 unformatted_nodes  +
>   		 unformatted_nodes * estimate_one_insert_into_item(tree) +
>   		 1 + estimate_one_insert_item(tree) +
>   		 inode_file_plugin(inode)->estimate.update(inode),
> -		 BA_CAN_COMMIT);
> +		 BA_CAN_COMMIT | BA_FORCE);
>   }
>   
>   /**
> diff --git a/fs/reiser4/plugin/file/tail_conversion.c b/fs/reiser4/plugin/file/tail_conversion.c
> index 1763cb1..22f30fd 100644
> --- a/fs/reiser4/plugin/file/tail_conversion.c
> +++ b/fs/reiser4/plugin/file/tail_conversion.c
> @@ -221,13 +221,13 @@ static int reserve_tail2extent_iteration(struct inode *inode)
>   	 *     5. possible update of stat-data
>   	 *
>   	 */
> -	grab_space_enable();
>   	return reiser4_grab_space
>   	    (2 * tree->height +
>   	     TAIL2EXTENT_PAGE_NUM +
>   	     TAIL2EXTENT_PAGE_NUM * estimate_one_insert_into_item(tree) +
>   	     1 + estimate_one_insert_item(tree) +
> -	     inode_file_plugin(inode)->estimate.update(inode), BA_CAN_COMMIT);
> +	     inode_file_plugin(inode)->estimate.update(inode),
> +	     BA_CAN_COMMIT | BA_FORCE);
>   }
>   
>   /* clear stat data's flag indicating that conversion is being converted */
> @@ -235,10 +235,9 @@ static int complete_conversion(struct inode *inode)
>   {
>   	int result;
>   
> -	grab_space_enable();
>   	result =
>   	    reiser4_grab_space(inode_file_plugin(inode)->estimate.update(inode),
> -			       BA_CAN_COMMIT);
> +			       BA_CAN_COMMIT | BA_FORCE);
>   	if (result == 0) {
>   		reiser4_inode_clr_flag(inode, REISER4_PART_MIXED);
>   		result = reiser4_update_sd(inode);
> @@ -552,12 +551,12 @@ static int reserve_extent2tail_iteration(struct inode *inode)
>   	 *
>   	 *     4. possible update of stat-data
>   	 */
> -	grab_space_enable();
>   	return reiser4_grab_space
>   	    (estimate_one_item_removal(tree) +
>   	     estimate_insert_flow(tree->height) +
>   	     1 + estimate_one_insert_item(tree) +
> -	     inode_file_plugin(inode)->estimate.update(inode), BA_CAN_COMMIT);
> +	     inode_file_plugin(inode)->estimate.update(inode),
> +	     BA_CAN_COMMIT | BA_FORCE);
>   }
>   
>   /* for every page of file: read page, cut part of extent pointing to this page,
> diff --git a/fs/reiser4/plugin/item/extent_file_ops.c b/fs/reiser4/plugin/item/extent_file_ops.c
> index cb57379..8086b5f 100644
> --- a/fs/reiser4/plugin/item/extent_file_ops.c
> +++ b/fs/reiser4/plugin/item/extent_file_ops.c
> @@ -933,8 +933,7 @@ static int write_extent_reserve_space(struct inode *inode)
>   	count = estimate_one_insert_item(tree) +
>   		WRITE_GRANULARITY * (1 + estimate_one_insert_into_item(tree)) +
>   		estimate_one_insert_item(tree);
> -	grab_space_enable();
> -	return reiser4_grab_space(count, 0 /* flags */);
> +	return reiser4_grab_space(count, BA_FORCE);
>   }
>   
>   /*
> diff --git a/fs/reiser4/plugin/item/tail.c b/fs/reiser4/plugin/item/tail.c
> index 7f4a101..67cb4ba 100644
> --- a/fs/reiser4/plugin/item/tail.c
> +++ b/fs/reiser4/plugin/item/tail.c
> @@ -603,8 +603,7 @@ static int write_extent_reserve_space(struct inode *inode)
>   	count = estimate_one_insert_item(tree) +
>   		estimate_insert_flow(tree->height) +
>   		estimate_one_insert_item(tree);
> -	grab_space_enable();
> -	return reiser4_grab_space(count, 0 /* flags */);
> +	return reiser4_grab_space(count, BA_FORCE);
>   }
>   
>   #define PAGE_PER_FLOW 4
> diff --git a/fs/reiser4/safe_link.c b/fs/reiser4/safe_link.c
> index d59f6f0..f4cff69 100644
> --- a/fs/reiser4/safe_link.c
> +++ b/fs/reiser4/safe_link.c
> @@ -130,13 +130,11 @@ int safe_link_grab(reiser4_tree * tree, reiser4_ba_flags_t flags)
>   {
>   	int result;
>   
> -	grab_space_enable();
>   	/* The sbinfo->delete_mutex can be taken here.
>   	 * safe_link_release() should be called before leaving reiser4
>   	 * context. */
>   	result =
> -	    reiser4_grab_reserved(tree->super, safe_link_tograb(tree), flags);
> -	grab_space_enable();
> +	    reiser4_grab_reserved(tree->super, safe_link_tograb(tree), flags | BA_FORCE);
>   	return result;
>   }
>   

OK

      reply	other threads:[~2014-10-18 17:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-18 14:14 [PATCH 0/3] reiser4: space grabbing fixes Ivan Shapovalov
2014-08-18 14:14 ` [PATCH 1/3] reiser4: block_alloc: improve error handling in reiser4_grab_reserved() Ivan Shapovalov
2014-10-18 17:43   ` Edward Shishkin
2014-08-18 14:14 ` [PATCH 2/3] reiser4: block_alloc: sanitize grab_enabled modifications Ivan Shapovalov
2014-10-18 17:47   ` Edward Shishkin
2014-10-20  9:43     ` Ivan Shapovalov
2014-11-16  5:39       ` Ivan Shapovalov
2014-08-18 14:14 ` [PATCH 3/3] reiser4: do not mess with grab_enabled; instead, use BA_FORCE Ivan Shapovalov
2014-10-18 17:48   ` Edward Shishkin [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=5442A7F0.40902@gmail.com \
    --to=edward.shishkin@gmail.com \
    --cc=intelfx100@gmail.com \
    --cc=reiserfs-devel@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).