ocfs2-devel.oss.oracle.com archive mirror
 help / color / mirror / Atom feed
From: Joseph Qi <jiangqi903@gmail.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH] ocfs2: don't evaluate buffer head to NULL managed by caller
Date: Fri, 30 Mar 2018 10:37:57 +0800	[thread overview]
Message-ID: <2be324cc-2a77-6b17-3441-1f17d6e24b24@gmail.com> (raw)
In-Reply-To: <63ADC13FD55D6546B7DECE290D39E373F2958E1B@H3CMLB12-EX.srv.huawei-3com.com>



On 18/3/30 10:17, Changwei Ge wrote:
>>>> Since we assume caller has to pass either all NULL or all non-NULL,
>>>> here we will only put bh internal allocated. Am I missing something?
>>> Thanks for your review.
>>> Yes, we will only put bh internally allocated.
>>> If bh is reserved in advance, we will not put it and re-assign it to NULL.
>>>
>> So this branch won't have risk, right?
> Sorry... I'm not sure if I understand you correctly.
> This branch will be walked through when previous part of bhs[] faces a read 
> failure in order to put bh allocated in ocfs2_read_blocks().
> And we assume all bh should be NULL or non-NULL, if new_bh is set, the back part 
> should also be put to release those buffer heads.
> 
> If I made a mistake or misunderstand you, please let me know.


I'm saying that sb_getblk() will only be called if bh hasn't been
allocated yet. That means if it fails, the bh to be put can be
guaranteed internal allocated.
Also I don't think the WARN check is necessary as this is common path
and will bring additional cpu consumption. We can make it clear at
comments of ocfs2_read_blocks() that either all NULL or non-NULL bhs
is prerequisite for the caller. And then we make sure we won't put bh
that is allocated outside.

Thanks,
Joseph

  reply	other threads:[~2018-03-30  2:37 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-29  2:06 [Ocfs2-devel] [PATCH] ocfs2: don't evaluate buffer head to NULL managed by caller Changwei Ge
2018-03-29  2:35 ` Gang He
2018-03-29  3:01   ` Changwei Ge
2018-03-29  3:21     ` Gang He
2018-03-29  6:25       ` Changwei Ge
2018-03-29  3:36 ` Larry Chen
2018-03-29  6:27   ` Changwei Ge
2018-03-29  9:50 ` piaojun
2018-03-29 10:32   ` Larry Chen
2018-03-29 12:04     ` Changwei Ge
2018-03-29 12:03   ` Changwei Ge
2018-03-29 21:45 ` Andrew Morton
2018-03-30  0:50   ` Changwei Ge
2018-03-30  1:26 ` Joseph Qi
2018-03-30  1:31   ` Changwei Ge
2018-03-30  2:03     ` Joseph Qi
2018-03-30  2:17       ` Changwei Ge
2018-03-30  2:37         ` Joseph Qi [this message]
2018-03-31  2:06           ` Changwei Ge
2018-03-30  2:16   ` piaojun

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=2be324cc-2a77-6b17-3441-1f17d6e24b24@gmail.com \
    --to=jiangqi903@gmail.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 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).