linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: harshad shirwadkar <harshadshirwadkar@gmail.com>
To: Andreas Dilger <adilger@dilger.ca>
Cc: Ext4 Developers List <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH v2 02/12] jbd2: add fast commit fields to journal_s structure
Date: Tue, 1 Oct 2019 00:50:58 -0700	[thread overview]
Message-ID: <CAD+ocby8+qHFUP1bi64gKyaJwg2muy8mRyRt3fqkxTWvJMVNSw@mail.gmail.com> (raw)
In-Reply-To: <13BA3D29-983E-4D7F-901E-3EF78201C9AB@dilger.ca>

Thanks, done in V3.


On Fri, Aug 9, 2019 at 12:48 PM Andreas Dilger <adilger@dilger.ca> wrote:
>
> On Aug 8, 2019, at 9:45 PM, Harshad Shirwadkar <harshadshirwadkar@gmail.com> wrote:
> >
> > For fast commits, JBD2 as of now allocates a default of 128 blocks at
> > the end of the journalling area. Although JBD2 owns these blocks, it
> > doesn't control what exactly should be written in these blocks. It
> > just provides the right abstraction for making these blocks usable by
> > file systems. This patch adds necessary fields to manage these fast
> > commit blocks.
> >
> > Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
>
> Contrary to the description, this patch doesn't really do anything beyond
> adding unused fields and constants to the header, and as such isn't really
> useful to land on its own since there is no way to see what the fields
> are used for.  In particular, I was going to say that JBD2_FAST_COMMIT_BLOCKS
> should only be reserved if the FAST_COMMIT feature is enabled (unlike what
> is written above, which implies that they are always reserved), otherwise
> it can impact filesystem performance even when the feature is not active.
>
> I'd recommend to merge these changes with the patch where the fields/constants
> are actually used.
>
> Cheers, Andreas
>
> > ---
> >
> > Changelog:
> >
> > V2: Added struct transaction_run_stats_s * argument to
> >    j_fc_commit_callback to collect stats
> > ---
> > include/linux/jbd2.h | 79 ++++++++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 79 insertions(+)
> >
> > diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
> > index b7eed49b8ecd..9a750b732241 100644
> > --- a/include/linux/jbd2.h
> > +++ b/include/linux/jbd2.h
> > @@ -66,6 +66,7 @@ void __jbd2_debug(int level, const char *file, const char *func,
> > extern void *jbd2_alloc(size_t size, gfp_t flags);
> > extern void jbd2_free(void *ptr, size_t size);
> >
> > +#define JBD2_FAST_COMMIT_BLOCKS 128
> > #define JBD2_MIN_JOURNAL_BLOCKS 1024
> >
> > #ifdef __KERNEL__
> > @@ -918,6 +919,34 @@ struct journal_s
> >        */
> >       unsigned long           j_last;
> >
> > +     /**
> > +      * @j_first_fc:
> > +      *
> > +      * The block number of the first fast commit block in the journal
> > +      */
> > +     unsigned long           j_first_fc;
> > +
> > +     /**
> > +      * @j_current_fc:
> > +      *
> > +      * Journal fc block iterator
> > +      */
> > +     unsigned long           j_fc_off;
> > +
> > +     /**
> > +      * @j_last_fc:
> > +      *
> > +      * The block number of the last fast commit block in the journal
> > +      */
> > +     unsigned long           j_last_fc;
> > +
> > +     /**
> > +      * @j_do_full_commit:
> > +      *
> > +      * Force a full commit. If this flag is set JBD2 won't try fast commits
> > +      */
> > +     bool                    j_do_full_commit;
> > +
> >       /**
> >        * @j_dev: Device where we store the journal.
> >        */
> > @@ -987,6 +1016,15 @@ struct journal_s
> >        */
> >       tid_t                   j_transaction_sequence;
> >
> > +     /**
> > +      * @j_subtid:
> > +      *
> > +      * One plus the sequence number of the most recently committed fast
> > +      * commit. This represents the sub transaction ID for the next fast
> > +      * commit.
> > +      */
> > +     tid_t                   j_subtid;
> > +
> >       /**
> >        * @j_commit_sequence:
> >        *
> > @@ -1068,6 +1106,20 @@ struct journal_s
> >        */
> >       int                     j_wbufsize;
> >
> > +     /**
> > +      * @j_fc_wbuf:
> > +      *
> > +      * Array of bhs for fast commit transactions
> > +      */
> > +     struct buffer_head      **j_fc_wbuf;
> > +
> > +     /**
> > +      * @j_fc_wbufsize:
> > +      *
> > +      * Size of @j_fc_wbufsize array.
> > +      */
> > +     int                     j_fc_wbufsize;
> > +
> >       /**
> >        * @j_last_sync_writer:
> >        *
> > @@ -1167,6 +1219,33 @@ struct journal_s
> >        */
> >       struct lockdep_map      j_trans_commit_map;
> > #endif
> > +     /**
> > +      * @j_fc_commit_callback:
> > +      *
> > +      * File-system specific function that performs actual fast commit
> > +      * operation. Should return 0 if the fast commit was successful, in that
> > +      * case, JBD2 will just increment journal->j_subtid and move on. If it
> > +      * returns < 0, JBD2 will fall-back to full commit.
> > +      */
> > +     int (*j_fc_commit_callback)(struct journal_s *journal, tid_t tid,
> > +                                 tid_t subtid,
> > +                                 struct transaction_run_stats_s *stats);
> > +     /**
> > +      * @j_fc_replay_callback:
> > +      *
> > +      * File-system specific function that performs replay of a fast
> > +      * commit. JBD2 calls this function for each fast commit block found in
> > +      * the journal.
> > +      */
> > +     int (*j_fc_replay_callback)(struct journal_s *journal,
> > +                                 struct buffer_head *bh);
> > +     /**
> > +      * @j_fc_cleanup_callback:
> > +      *
> > +      * Clean-up after fast commit or full commit. JBD2 calls this function
> > +      * after every commit operation.
> > +      */
> > +     void (*j_fc_cleanup_callback)(struct journal_s *journal);
> > };
> >
> > #define jbd2_might_wait_for_commit(j) \
> > --
> > 2.23.0.rc1.153.gdeed80330f-goog
> >
>
>
> Cheers, Andreas
>
>
>
>
>

  reply	other threads:[~2019-10-01  7:51 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-09  3:45 [PATCH v2 00/12] ext4: add support fast commit Harshad Shirwadkar
2019-08-09  3:45 ` [PATCH v2 01/12] ext4: add handling for extended mount options Harshad Shirwadkar
2019-08-09 19:41   ` Andreas Dilger
2019-08-12 14:22   ` Theodore Y. Ts'o
2019-08-09  3:45 ` [PATCH v2 02/12] jbd2: add fast commit fields to journal_s structure Harshad Shirwadkar
2019-08-09 19:48   ` Andreas Dilger
2019-10-01  7:50     ` harshad shirwadkar [this message]
2019-08-09  3:45 ` [PATCH v2 03/12] jbd2: fast commit setup and enable Harshad Shirwadkar
2019-08-09 20:02   ` Andreas Dilger
2019-10-01  7:52     ` harshad shirwadkar
2019-11-01 11:22       ` xiaohui li
2019-08-09  3:45 ` [PATCH v2 04/12] jbd2: fast-commit commit path changes Harshad Shirwadkar
2019-08-09 20:22   ` Andreas Dilger
2019-10-01  7:43     ` harshad shirwadkar
2019-08-09  3:45 ` [PATCH v2 05/12] jbd2: fast-commit commit path new APIs Harshad Shirwadkar
2019-08-09 20:38   ` Andreas Dilger
2019-08-09 21:11     ` Andreas Dilger
2019-08-09 21:20       ` harshad shirwadkar
2019-08-12 16:04   ` Theodore Y. Ts'o
2019-08-12 17:41     ` harshad shirwadkar
2019-08-12 18:01       ` Theodore Y. Ts'o
2019-08-09  3:45 ` [PATCH v2 06/12] jbd2: fast-commit recovery path changes Harshad Shirwadkar
2019-08-09 20:57   ` Andreas Dilger
2019-08-09  3:45 ` [PATCH v2 07/12] ext4: add fields that are needed to track changed files Harshad Shirwadkar
2019-08-09 21:23   ` Andreas Dilger
2019-10-01  7:50     ` harshad shirwadkar
2019-08-09  3:45 ` [PATCH v2 08/12] ext4: track changed files for fast commit Harshad Shirwadkar
2019-08-09 21:46   ` Andreas Dilger
2019-10-01  7:51     ` harshad shirwadkar
2019-08-09  3:45 ` [PATCH v2 09/12] ext4: fast-commit commit range tracking Harshad Shirwadkar
2019-08-09  3:45 ` [PATCH v2 10/12] ext4: fast-commit commit path changes Harshad Shirwadkar
2019-08-09  3:45 ` [PATCH v2 11/12] ext4: fast-commit recovery " Harshad Shirwadkar
2019-08-09  3:45 ` [PATCH v2 12/12] docs: Add fast commit documentation Harshad Shirwadkar
2019-08-16  1:00   ` Darrick J. Wong
2019-08-20  6:38     ` harshad shirwadkar
2019-08-21 15:21       ` Darrick J. Wong

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=CAD+ocby8+qHFUP1bi64gKyaJwg2muy8mRyRt3fqkxTWvJMVNSw@mail.gmail.com \
    --to=harshadshirwadkar@gmail.com \
    --cc=adilger@dilger.ca \
    --cc=linux-ext4@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;
as well as URLs for NNTP newsgroup(s).