RE: [f2fs-dev] [PATCH] f2fs: remove the own bi_private allocation

From: Jaegeuk Kim
Date: Tue Dec 03 2013 - 04:37:31 EST


It causes NULL pointer error without f2fs_bug_on(), so I don't think we
need to add this.
Thanks,

2013-12-02 (ì), 16:59 +0800, Chao Yu:
> Hi Kim,
>
> > -----Original Message-----
> > From: Jaegeuk Kim [mailto:jaegeuk.kim@xxxxxxxxxxx]
> > Sent: Monday, December 02, 2013 4:15 PM
> > To: Chao Yu
> > Cc: linux-fsdevel@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; linux-f2fs-devel@xxxxxxxxxxxxxxxxxxxxx; èå
> > Subject: RE: [f2fs-dev] [PATCH] f2fs: remove the own bi_private allocation
> >
> > 2013-12-02 (ì), 14:14 +0800, Chao Yu:
> > > Hi Kim,
> > >
> > > > -----Original Message-----
> > > > From: Jaegeuk Kim [mailto:jaegeuk.kim@xxxxxxxxxxx]
> > > > Sent: Saturday, November 30, 2013 9:48 AM
> > > > Cc: linux-fsdevel@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; linux-f2fs-devel@xxxxxxxxxxxxxxxxxxxxx
> > > > Subject: [f2fs-dev] [PATCH] f2fs: remove the own bi_private allocation
> > > >
> > > > Previously f2fs allocates its own bi_private data structure all the time even
> > > > though we don't use it. But, can we remove this bi_private allocation?
> > > >
> > > > This patch removes such the additional bi_private allocation.
> > > >
> > > > 1. Retrieve f2fs_sb_info from its page->mapping->host->i_sb.
> > > > - This removes the usecases of bi_private in end_io.
> > > >
> > > > 2. Use bi_private only when we really need it.
> > > > - The bi_private is used only when the checkpoint procedure is conducted.
> > > > - When conducting the checkpoint, f2fs submits a META_FLUSH bio to wait its bio
> > > > completion.
> > > > - Since we have no dependancies to remove bi_private now, let's just use
> > > > bi_private pointer as the completion pointer.
> > > >
> > > > Signed-off-by: Jaegeuk Kim <jaegeuk.kim@xxxxxxxxxxx>
> > > > ---
> > > > fs/f2fs/segment.c | 43 ++++++++++++++++---------------------------
> > > > fs/f2fs/segment.h | 7 -------
> > > > 2 files changed, 16 insertions(+), 34 deletions(-)
> > > >
> > > > diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> > > > index 0387863..0db4027 100644
> > > > --- a/fs/f2fs/segment.c
> > > > +++ b/fs/f2fs/segment.c
> > > > @@ -791,7 +791,7 @@ static void f2fs_end_io_write(struct bio *bio, int err)
> > > > {
> > > > const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
> > > > struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1;
> > > > - struct bio_private *p = bio->bi_private;
>
> f2fs_bug_on(unlikely(!bvec->bv_page->mapping));
>
> > > > + struct f2fs_sb_info *sbi = F2FS_SB(bvec->bv_page->mapping->host->i_sb);
> > >
> > > I'm not sure whether bvec->bv_page->mapping will be set to NULL in the flow
> > > where may not check WRITEBACK flag of page. Is it possible?
> >
> > The mapping should be not NULL cause it is a writebacking page.
> > Otherwise, it's a bug.
>
> If so, should we add additional code as above?
>
> Regards,
> Yu
>
> > Thanks,
> >
> > --
> > Jaegeuk Kim
> > Samsung
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at http://vger.kernel.org/majordomo-info.html

--
Jaegeuk Kim
Samsung

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/