public inbox for linux-unionfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Chandan Rajendra <chandan@linux.vnet.ibm.com>
To: "linux-unionfs@vger.kernel.org" <linux-unionfs@vger.kernel.org>
Cc: Amir Goldstein <amir73il@gmail.com>
Subject: ovl_dir_read_merged: Redundant call to list_add()
Date: Tue, 30 May 2017 12:09:56 +0530	[thread overview]
Message-ID: <1982032.d2FfUCRVGU@localhost.localdomain> (raw)

ovl_dir_read_merged() has the following loop,

        for (idx = 0; idx != -1; idx = next) {
                next = ovl_path_next(idx, dentry, &realpath);

                if (next != -1) {
                        err = ovl_dir_read(&realpath, &rdd);
                        if (err)
                                break;
                } else {
                        /*                                                                                                                                                                                                                     
                         * Insert lowest layer entries before upper ones, this                                                                                                                                                                 
                         * allows offsets to be reasonably constant                                                                                                                                                                            
                         */
                        list_add(&rdd.middle, rdd.list);
                        rdd.is_lowest = true;
                        err = ovl_dir_read(&realpath, &rdd);
                        list_del(&rdd.middle);
                }
        }


rdd.middle is populated inside ovl_fill_lowest() which is indirectly invoked
by the call to ovl_dir_read() inside the "else" part of the above "if"
condition. Before this invocation of ovl_dir_read(), rdd.middle would
basically be an empty list. So this would mean that the call
list_add(&rdd.middle, rdd.list) is unnecessary.

Please let me know if I am missing something here.

-- 
chandan

             reply	other threads:[~2017-05-30  6:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-30  6:39 Chandan Rajendra [this message]
2017-05-30  8:05 ` ovl_dir_read_merged: Redundant call to list_add() Amir Goldstein
2017-05-30  8:47   ` Chandan Rajendra

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=1982032.d2FfUCRVGU@localhost.localdomain \
    --to=chandan@linux.vnet.ibm.com \
    --cc=amir73il@gmail.com \
    --cc=linux-unionfs@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