All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Lightsey <john@nixnuts.net>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH] Bug#841144: kernel BUG at /build/linux-Wgpe2M/linux-4.8.11/fs/ocfs2/alloc.c:1514!
Date: Mon, 20 Nov 2017 22:24:56 -0600	[thread overview]
Message-ID: <1511238296.2765.1.camel@nixnuts.net> (raw)
In-Reply-To: <5A1397BE.9070808@huawei.com>

On Tue, 2017-11-21 at 11:04 +0800, piaojun wrote:
> > > ?	new = NULL;
> > > ?unlock:
> > > ?	spin_unlock(&oi->ip_lock);
> > > @@ -2246,7 +2250,7 @@ static int ocfs2_dio_get_block(struct inode
> > > *inode, sector_t iblock,
> > > ?		ue->ue_phys = desc->c_phys;
> > > ?
> > > ?		list_splice_tail_init(&wc->w_unwritten_list,
> > > &dwc->dw_zero_list);
> > > -		dwc->dw_zero_count++;
> > > +		dwc->dw_zero_count += wc->w_unwritten_count;
> 
> I prefer using a loop to calculate 'dwc->dw_zero_count' rather than
> introducing a new variable as below:
> 
> list_for_each(iter, &wc->w_unwritten_list)
> 	dwc->dw_zero_count++;

If you want to iterate through the list to calculate the length rather
than tracking the length as the list grows, it would make more sense to
remove dw_zero_count.

If you'd prefer walking all of the elements to calculate the length,
this can just be done in ocfs2_dio_end_io_write() where the length of
the list is actually used.

I assumed that the intent of dw_zero_count was to avoid an unnecessary
iteration through dw_zero_list to determine the length.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
Url : http://oss.oracle.com/pipermail/ocfs2-devel/attachments/20171120/85820571/attachment-0001.bin 

      reply	other threads:[~2017-11-21  4:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-20 18:54 [Ocfs2-devel] [PATCH] Bug#841144: kernel BUG at /build/linux-Wgpe2M/linux-4.8.11/fs/ocfs2/alloc.c:1514! John Lightsey
2017-11-21  0:58 ` Changwei Ge
2017-11-21  2:45   ` John Lightsey
2017-11-21  5:58     ` Changwei Ge
2017-11-21 21:05       ` John Lightsey
2017-11-24  5:46         ` alex chen
2017-11-24  7:03           ` Changwei Ge
2017-11-24 10:06             ` alex chen
2017-11-28 14:34           ` John Lightsey
2017-11-29  4:37             ` alex chen
2017-11-21  3:04   ` piaojun
2017-11-21  4:24     ` John Lightsey [this message]

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=1511238296.2765.1.camel@nixnuts.net \
    --to=john@nixnuts.net \
    --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.