All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sunil Mushran <Sunil.Mushran@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH 1/3] Add a new parameter for	ocfs2_reserve_suballoc_bits.V3
Date: Mon Mar  3 18:32:17 2008	[thread overview]
Message-ID: <47CCB34D.7060000@oracle.com> (raw)
In-Reply-To: <20080303091209.GA18111@tma-pc1.cn.oracle.com>

Tao Ma wrote:
> In some cases(Inode stealing from other nodes), we may not want
> ocfs2_reserve_suballoc_bits to allocate new groups from the
> global_bitmap since it may already be full. So add a new parameter
> for this.
>
> Signed-off-by: Tao Ma <tao.ma@oracle.com>
> Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
>   

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>

> ---
>  fs/ocfs2/suballoc.c |   22 ++++++++++++++++++----
>  1 files changed, 18 insertions(+), 4 deletions(-)
>
> diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
> index 72c198a..3be4e73 100644
> --- a/fs/ocfs2/suballoc.c
> +++ b/fs/ocfs2/suballoc.c
> @@ -46,6 +46,9 @@
>  
>  #include "buffer_head_io.h"
>  
> +#define NOT_ALLOC_NEW_GROUP		0
> +#define ALLOC_NEW_GROUP			1
> +
>  static inline void ocfs2_debug_bg(struct ocfs2_group_desc *bg);
>  static inline void ocfs2_debug_suballoc_inode(struct ocfs2_dinode *fe);
>  static inline u16 ocfs2_find_victim_chain(struct ocfs2_chain_list *cl);
> @@ -391,7 +394,8 @@ bail:
>  static int ocfs2_reserve_suballoc_bits(struct ocfs2_super *osb,
>  				       struct ocfs2_alloc_context *ac,
>  				       int type,
> -				       u32 slot)
> +				       u32 slot,
> +				       int alloc_new_group)
>  {
>  	int status;
>  	u32 bits_wanted = ac->ac_bits_wanted;
> @@ -446,6 +450,14 @@ static int ocfs2_reserve_suballoc_bits(struct ocfs2_super *osb,
>  			goto bail;
>  		}
>  
> +		if (alloc_new_group != ALLOC_NEW_GROUP) {
> +			mlog(0, "Alloc File %u Full: wanted=%u, free_bits=%u, "
> +			     "and we don't alloc a new group for it.\n",
> +			     slot, bits_wanted, free_bits);
> +			status = -ENOSPC;
> +			goto bail;
> +		}
> +
>  		status = ocfs2_block_group_alloc(osb, alloc_inode, bh);
>  		if (status < 0) {
>  			if (status != -ENOSPC)
> @@ -490,7 +502,8 @@ int ocfs2_reserve_new_metadata(struct ocfs2_super *osb,
>  	(*ac)->ac_group_search = ocfs2_block_group_search;
>  
>  	status = ocfs2_reserve_suballoc_bits(osb, (*ac),
> -					     EXTENT_ALLOC_SYSTEM_INODE, slot);
> +					     EXTENT_ALLOC_SYSTEM_INODE,
> +					     slot, ALLOC_NEW_GROUP);
>  	if (status < 0) {
>  		if (status != -ENOSPC)
>  			mlog_errno(status);
> @@ -527,7 +540,7 @@ int ocfs2_reserve_new_inode(struct ocfs2_super *osb,
>  
>  	status = ocfs2_reserve_suballoc_bits(osb, *ac,
>  					     INODE_ALLOC_SYSTEM_INODE,
> -					     osb->slot_num);
> +					     osb->slot_num, ALLOC_NEW_GROUP);
>  	if (status < 0) {
>  		if (status != -ENOSPC)
>  			mlog_errno(status);
> @@ -557,7 +570,8 @@ int ocfs2_reserve_cluster_bitmap_bits(struct ocfs2_super *osb,
>  
>  	status = ocfs2_reserve_suballoc_bits(osb, ac,
>  					     GLOBAL_BITMAP_SYSTEM_INODE,
> -					     OCFS2_INVALID_SLOT);
> +					     OCFS2_INVALID_SLOT,
> +					     ALLOC_NEW_GROUP);
>  	if (status < 0 && status != -ENOSPC) {
>  		mlog_errno(status);
>  		goto bail;
>   

  reply	other threads:[~2008-03-03 18:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-03  1:00 [Ocfs2-devel] [PATCH 0/3] Add inode stealing in ocfs2.V3 Tao Ma
2008-03-03  1:13 ` [Ocfs2-devel] [PATCH 1/3] Add a new parameter for ocfs2_reserve_suballoc_bits.V3 Tao Ma
2008-03-03 18:32   ` Sunil Mushran [this message]
2008-03-03  1:13 ` [Ocfs2-devel] [PATCH 2/3] Add ac_alloc_slot in ocfs2_alloc_context.V3 Tao Ma
2008-03-03 18:25   ` Sunil Mushran
2008-03-03  1:13 ` [Ocfs2-devel] [PATCH 3/3] Add inode stealing for ocfs2_reserve_new_inode.V3 Tao Ma
2008-03-03 18:25   ` Sunil Mushran
2008-03-03 18:47     ` Tao Ma
2008-03-03 18:57       ` Sunil Mushran
2008-03-03 19:21         ` Tao Ma
2008-03-04  0:55     ` [Ocfs2-devel] [PATCH 3/3] Add inode stealing for ocfs2_reserve_new_inode.V4 Tao Ma
2008-03-04 16:48       ` Mark Fasheh
2008-03-05  0:13         ` [Ocfs2-devel] [PATCH 3/3] Add inode stealing for ocfs2_reserve_new_inode.V5 Tao Ma

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=47CCB34D.7060000@oracle.com \
    --to=sunil.mushran@oracle.com \
    --cc=ocfs2-devel@oss.oracle.com \
    /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.