Skip to contentSkip to conversation

write_out_data in JBD

DISCUSSION Zoltan Menyhart 2 participants 2 messages May 18, 2006 – May 19, 2006

lore
Share & tools
lore
#0 lore raw

Stephen,

Here is a code fragment starting at "write_out_data:" in "journal_commit_transaction()":

Let's assume that there is a single "jh" on the list.

write_out_data:
while (commit_transaction->t_sync_datalist) {

      jh = commit_transaction->t_sync_datalist;
      commit_transaction->t_sync_datalist = jh->b_tnext;

      // "commit_transaction->t_sync_datalist" happens always
      // to point at our single "jh"

      bh = jh2bh(jh);

      // Assume not locked
      // Assume dirty

      if (buffer_dirty(bh)) {
          get_bh(bh);
          wbuf[bufs++] = bh;
          if (bufs == journal->j_wbufsize) {
              ...
              goto write_out_data;
          }
      } else ...

}

I think our single "jh" will be put on "wbuf[]" repeatedly ("journal->j_wbufsize" times).

Regards,

Zoltan Menyhart

#1 lore raw

Hello,

Quoted 1 line

Stephen,

I'm not Stephen but I guess my answer would suffice ;)

Quoted 4 lines

Here is a code fragment starting at "write_out_data:" in "journal_commit_transaction()":

Let's assume that there is a single "jh" on the list.

OK.

Quoted 18 lines
  while (commit_transaction->t_sync_datalist) {
      jh = commit_transaction->t_sync_datalist;
      commit_transaction->t_sync_datalist = jh->b_tnext;

      // "commit_transaction->t_sync_datalist" happens always
      // to point at our single "jh"

      bh = jh2bh(jh);

      // Assume not locked
      // Assume dirty

      if (buffer_dirty(bh)) {
          get_bh(bh);
          wbuf[bufs++] = bh;
          if (bufs == journal->j_wbufsize) {

Now this would not happen as j_wbufsize is larger than 1. But still
even if it would happen ll_rw_block() would be called, that would clear a dirty bit and and the next time we see the buffer we take a different route.
But actually you are right that if we fail with
bufs==journal->j_wbufsize we would go into the next iteration of the loop and queue the buffer again. Anyway we agreed to rewrite this code in another thread :). I just have to make sure we don't have a similar problem in the new version.

Quoted 8 lines
              ...
              goto write_out_data;
          }
      } else ...

}

I think our single "jh" will be put on "wbuf[]" repeatedly ("journal->j_wbufsize" times).

Honza

Signature · 2 lines
Jan Kara <[email protected]>
SuSE CR Labs