From: Jan Kara <jack@suse.cz>
To: Josef Bacik <josef@toxicpanda.com>
Cc: hannes@cmpxchg.org, linux-mm@kvack.org,
akpm@linux-foundation.org, jack@suse.cz,
linux-fsdevel@vger.kernel.org, kernel-team@fb.com,
linux-btrfs@vger.kernel.org, Josef Bacik <jbacik@fb.com>
Subject: Re: [PATCH v3 06/10] writeback: introduce super_operations->write_metadata
Date: Tue, 19 Dec 2017 13:21:04 +0100 [thread overview]
Message-ID: <20171219122104.GF2277@quack2.suse.cz> (raw)
In-Reply-To: <1513029335-5112-7-git-send-email-josef@toxicpanda.com>
On Mon 11-12-17 16:55:31, Josef Bacik wrote:
> @@ -1621,12 +1647,18 @@ static long writeback_sb_inodes(struct super_block *sb,
> * background threshold and other termination conditions.
> */
> if (wrote) {
> - if (time_is_before_jiffies(start_time + HZ / 10UL))
> - break;
> - if (work->nr_pages <= 0)
> + if (time_is_before_jiffies(start_time + HZ / 10UL) ||
> + work->nr_pages <= 0) {
> + done = true;
> break;
> + }
> }
> }
> + if (!done && sb->s_op->write_metadata) {
> + spin_unlock(&wb->list_lock);
> + wrote += writeback_sb_metadata(sb, wb, work);
> + spin_lock(&wb->list_lock);
> + }
> return wrote;
> }
One thing I've notice when looking at this patch again: This duplicates the
metadata writeback done in __writeback_inodes_wb(). So you probably need a
new helper function like writeback_sb() that will call writeback_sb_inodes()
and handle metadata writeback and call that from wb_writeback() instead of
writeback_sb_inodes() directly.
Honza
> @@ -1635,6 +1667,7 @@ static long __writeback_inodes_wb(struct bdi_writeback *wb,
> {
> unsigned long start_time = jiffies;
> long wrote = 0;
> + bool done = false;
>
> while (!list_empty(&wb->b_io)) {
> struct inode *inode = wb_inode(wb->b_io.prev);
> @@ -1654,12 +1687,39 @@ static long __writeback_inodes_wb(struct bdi_writeback *wb,
>
> /* refer to the same tests at the end of writeback_sb_inodes */
> if (wrote) {
> - if (time_is_before_jiffies(start_time + HZ / 10UL))
> - break;
> - if (work->nr_pages <= 0)
> + if (time_is_before_jiffies(start_time + HZ / 10UL) ||
> + work->nr_pages <= 0) {
> + done = true;
> break;
> + }
> }
> }
> +
> + if (!done && wb_stat(wb, WB_METADATA_DIRTY_BYTES)) {
> + LIST_HEAD(list);
> +
> + spin_unlock(&wb->list_lock);
> + spin_lock(&wb->bdi->sb_list_lock);
> + list_splice_init(&wb->bdi->dirty_sb_list, &list);
> + while (!list_empty(&list)) {
> + struct super_block *sb;
> +
> + sb = list_first_entry(&list, struct super_block,
> + s_bdi_dirty_list);
> + list_move_tail(&sb->s_bdi_dirty_list,
> + &wb->bdi->dirty_sb_list);
> + if (!sb->s_op->write_metadata)
> + continue;
> + if (!trylock_super(sb))
> + continue;
> + spin_unlock(&wb->bdi->sb_list_lock);
> + wrote += writeback_sb_metadata(sb, wb, work);
> + spin_lock(&wb->bdi->sb_list_lock);
> + up_read(&sb->s_umount);
> + }
> + spin_unlock(&wb->bdi->sb_list_lock);
> + spin_lock(&wb->list_lock);
> + }
> /* Leave any unwritten inodes on b_io */
> return wrote;
> }
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2017-12-19 12:21 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-11 21:55 [PATCH v3 00/11] Metadata specific accouting and dirty writeout Josef Bacik
2017-12-11 21:55 ` [PATCH v3 01/10] remove mapping from balance_dirty_pages*() Josef Bacik
2017-12-11 21:55 ` [PATCH v3 02/10] writeback: convert WB_WRITTEN/WB_DIRITED counters to bytes Josef Bacik
2017-12-11 21:55 ` [PATCH v3 03/10] lib: add a __fprop_add_percpu_max Josef Bacik
2017-12-19 7:25 ` Jan Kara
2017-12-11 21:55 ` [PATCH v3 04/10] writeback: convert the flexible prop stuff to bytes Josef Bacik
2017-12-11 21:55 ` [PATCH v3 05/10] writeback: add counters for metadata usage Josef Bacik
2017-12-19 7:52 ` Jan Kara
2017-12-11 21:55 ` [PATCH v3 06/10] writeback: introduce super_operations->write_metadata Josef Bacik
2017-12-11 23:36 ` Dave Chinner
2017-12-12 18:05 ` Josef Bacik
2017-12-12 22:20 ` Dave Chinner
2017-12-12 23:59 ` Josef Bacik
2017-12-19 12:07 ` Jan Kara
2017-12-19 21:35 ` Dave Chinner
2017-12-20 14:30 ` Jan Kara
2018-01-02 16:13 ` Josef Bacik
2018-01-03 2:32 ` Dave Chinner
2018-01-03 13:59 ` Jan Kara
2018-01-03 15:49 ` Josef Bacik
2018-01-03 16:26 ` Jan Kara
2018-01-03 16:29 ` Josef Bacik
2018-01-29 9:06 ` Chandan Rajendra
2018-09-28 8:37 ` Chandan Rajendra
2018-01-04 1:32 ` Dave Chinner
2018-01-04 9:10 ` Jan Kara
2017-12-19 12:21 ` Jan Kara [this message]
2017-12-11 21:55 ` [PATCH v3 07/10] export radix_tree_iter_tag_set Josef Bacik
2017-12-11 21:55 ` [PATCH v3 08/10] Btrfs: kill the btree_inode Josef Bacik
2017-12-11 21:55 ` [PATCH v3 09/10] btrfs: rework end io for extent buffer reads Josef Bacik
2017-12-11 21:55 ` [PATCH v3 10/10] btrfs: add NR_METADATA_BYTES accounting Josef Bacik
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=20171219122104.GF2277@quack2.suse.cz \
--to=jack@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=jbacik@fb.com \
--cc=josef@toxicpanda.com \
--cc=kernel-team@fb.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.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).