From: Jan Kara <jack@suse.cz>
To: Namjae Jeon <linkinjeon@gmail.com>
Cc: Jan Kara <jack@suse.cz>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
Namjae Jeon <namjae.jeon@samsung.com>,
Ashish Sangwan <a.sangwan@samsung.com>,
Bonggil Bak <bgbak@samsung.com>
Subject: Re: [PATCH] udf: add extent cache support in case of file reading
Date: Mon, 4 Feb 2013 11:21:27 +0100 [thread overview]
Message-ID: <20130204102127.GB7523@quack.suse.cz> (raw)
In-Reply-To: <CAKYAXd8YuAmy+EDK9ck8n1kq_GgzRUfhSbgrVZWa5sdaPUKPKA@mail.gmail.com>
On Sat 02-02-13 15:21:09, Namjae Jeon wrote:
> Hi. Jan.
>
> Sorry for interrupt.
> Have you taken this patch to your tree ? I can not find it..
> or Is there any issue regarding this patch ?
I had it in my tree but not in the for_next branch. Did it now so you
should see the patch in tomorrow's linux-next.
Honza
> 2013/1/22, Namjae Jeon <linkinjeon@gmail.com>:
> > 2013/1/22, Jan Kara <jack@suse.cz>:
> >> On Tue 22-01-13 09:45:09, Namjae Jeon wrote:
> >>> 2013/1/21, Jan Kara <jack@suse.cz>:
> >>> > @@ -2222,6 +2219,8 @@ int udf_read_extent_cache(struct inode *inode,
> >>> > loff_t
> >>> > bcount,
> >>> > *lbcount = iinfo->cached_extent.lstart;
> >>> > memcpy(pos, &iinfo->cached_extent.epos,
> >>> > sizeof(struct extent_position));
> >>> > + if (pos->bh)
> >>> > + get_bh(pos->bh);
> >>> > spin_unlock(&iinfo->i_extent_cache_lock);
> >>> > return 1;
> >>> > } else
> >>> > This is the most important - we should give buffer reference to
> >>> > pos->bh.
> >>> > Caller will eventually free it right?
> >>> This change is not required as we give buffer reference to pos->bh at
> >>> the time of cache update.
> >>> When we start reading a file, first we try to read the cache which
> >>> will lead to cache miss.
> >>> So, we would really access the pos->bh in udf_update_extent_cache for
> >>> the first time, and this is where the buffer reference is incremented.
> >>> Calling get_bh at 2 places will eventually lead to mem leak.
> >>> Let me know your opinion.
> >> Yes, udf_update_extent_cache() gets its own reference to bh but that is
> >> dropped in udf_clear_extent_cache(). So I think udf_read_extent_cache()
> >> needs to get a reference to the caller (as the caller will eventually
> >> free
> >> the bh via brelse(epos.bh) e.g. in udf_extend_file(). Also I realized
> >> udf_update_extent_cache() needs to first clear the cache if it is valid.
> >> Otherwise it just overwrites bh pointer and reference is leaked. Is it
> >> clearer now?
> > Yes, you're right. Also, this patch looks good to me.
> >>
> >> I've also changed locking of udf_clear_extent_cache() so that
> >> i_extent_cache_lock is always taken for that function - it makes the
> >> locking rules obvious at the first sight.
> > Yes, right. it is needed.
> > When we test with this patch, working fine.
> > Thanks Jan!
> >>
> >> Attached is the patch I currently carry.
> >>
> >> Honza
> >>
> >> --
> >> Jan Kara <jack@suse.cz>
> >> SUSE Labs, CR
> >>
> >
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
next prev parent reply other threads:[~2013-02-04 10:21 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-19 2:17 [PATCH] udf: add extent cache support in case of file reading Namjae Jeon
2013-01-19 2:29 ` Cong Ding
2013-01-21 2:18 ` Namjae Jeon
2013-01-21 11:04 ` Jan Kara
2013-01-22 0:45 ` Namjae Jeon
2013-01-22 10:04 ` Jan Kara
2013-01-22 11:49 ` Namjae Jeon
2013-02-02 6:21 ` Namjae Jeon
2013-02-04 10:21 ` Jan Kara [this message]
2013-02-04 10:28 ` Namjae Jeon
-- strict thread matches above, loose matches on Subject: below --
2013-01-12 6:13 Namjae Jeon
2013-01-14 14:56 ` Jan Kara
2013-01-15 2:05 ` Namjae Jeon
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=20130204102127.GB7523@quack.suse.cz \
--to=jack@suse.cz \
--cc=a.sangwan@samsung.com \
--cc=bgbak@samsung.com \
--cc=linkinjeon@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=namjae.jeon@samsung.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).