All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joel Becker <jlbec@evilplan.org>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH 4/4] ocfs2: limit the number of inodes in orphanscan
Date: Sun, 21 Aug 2011 21:47:22 -0700	[thread overview]
Message-ID: <20110822044722.GJ31134@noexit.corp.google.com> (raw)
In-Reply-To: <201107291006.p6TA6aSZ010899@acsmt358.oracle.com>

On Fri, Jul 29, 2011 at 06:06:23PM +0800, Wengang Wang wrote:
> During orphanscan, limit the scan number in a single loop to avoid OOM.

How does this OOM?  Please explain this in the patch and in the patch
description.  Or, conversely, free the resources the orphan scan is done
using.

Joel

> 
> Signed-off-by: Wengang Wang <wen.gang.wang@oracle.com>
> ---
>  fs/ocfs2/journal.c |    9 +++++++++
>  1 files changed, 9 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
> index 7d4e1ca..1c0487b 100644
> --- a/fs/ocfs2/journal.c
> +++ b/fs/ocfs2/journal.c
> @@ -56,6 +56,7 @@
>  DEFINE_SPINLOCK(trans_inc_lock);
>  
>  #define ORPHAN_SCAN_SCHEDULE_TIMEOUT 300000
> +#define ORPHAN_SCAN_ITEMS_PER_LOOP 1000
>  
>  static int ocfs2_force_read_journal(struct inode *inode);
>  static int ocfs2_recover_node(struct ocfs2_super *osb,
> @@ -1926,6 +1927,7 @@ struct ocfs2_orphan_filldir_priv {
>  	struct inode		*head;
>  	struct ocfs2_super	*osb;
>  	struct 			inode *orphan_dir;
> +	int			count;
>  };
>  
>  static int ocfs2_orphan_filldir(void *priv, const char *name, int name_len,
> @@ -1964,6 +1966,12 @@ static int ocfs2_orphan_filldir(void *priv, const char *name, int name_len,
>  	}
>  	spin_unlock(&o_orphandir->ip_lock);
>  
> +	/*
> +	 * reading limited number of inodes in a single loop to avoid OOM
> +	 */
> +	if ( ++p->count == ORPHAN_SCAN_ITEMS_PER_LOOP )
> +		return -EAGAIN;
> +
>  	return 0;
>  }
>  
> @@ -1978,6 +1986,7 @@ static int ocfs2_queue_orphans(struct ocfs2_super *osb,
>  
>  	priv.osb = osb;
>  	priv.head = *head;
> +	priv.count = 0;
>  
>  	orphan_dir_inode = ocfs2_get_system_file_inode(osb,
>  						       ORPHAN_DIR_SYSTEM_INODE,
> -- 
> 1.7.5.2
> 
> 
> _______________________________________________
> Ocfs2-devel mailing list
> Ocfs2-devel at oss.oracle.com
> http://oss.oracle.com/mailman/listinfo/ocfs2-devel

-- 

"Get right to the heart of matters.
 It's the heart that matters more."

			http://www.jlbec.org/
			jlbec at evilplan.org

  reply	other threads:[~2011-08-22  4:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-29 10:06 [Ocfs2-devel] [PATCH 4/4] ocfs2: limit the number of inodes in orphanscan Wengang Wang
2011-08-22  4:47 ` Joel Becker [this message]
2011-08-22  5:51   ` Wengang Wang
2011-08-22  8:19     ` Joel Becker
2011-08-22  8:55       ` Wengang Wang

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=20110822044722.GJ31134@noexit.corp.google.com \
    --to=jlbec@evilplan.org \
    --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.