Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4452226e authored by Tejun Heo's avatar Tejun Heo Committed by Jens Axboe
Browse files

writeback: move backing_dev_info->state into bdi_writeback



Currently, a bdi (backing_dev_info) embeds single wb (bdi_writeback)
and the role of the separation is unclear.  For cgroup support for
writeback IOs, a bdi will be updated to host multiple wb's where each
wb serves writeback IOs of a different cgroup on the bdi.  To achieve
that, a wb should carry all states necessary for servicing writeback
IOs for a cgroup independently.

This patch moves bdi->state into wb.

* enum bdi_state is renamed to wb_state and the prefix of all enums is
  changed from BDI_ to WB_.

* Explicit zeroing of bdi->state is removed without adding zeoring of
  wb->state as the whole data structure is zeroed on init anyway.

* As there's still only one bdi_writeback per backing_dev_info, all
  uses of bdi->state are mechanically replaced with bdi->wb.state
  introducing no behavior changes.

Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Reviewed-by: default avatarJan Kara <jack@suse.cz>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Cc: drbd-dev@lists.linbit.com
Cc: Neil Brown <neilb@suse.de>
Cc: Alasdair Kergon <agk@redhat.com>
Cc: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent ad7fa852
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -621,7 +621,6 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id)


	q->backing_dev_info.ra_pages =
	q->backing_dev_info.ra_pages =
			(VM_MAX_READAHEAD * 1024) / PAGE_CACHE_SIZE;
			(VM_MAX_READAHEAD * 1024) / PAGE_CACHE_SIZE;
	q->backing_dev_info.state = 0;
	q->backing_dev_info.capabilities = 0;
	q->backing_dev_info.capabilities = 0;
	q->backing_dev_info.name = "block";
	q->backing_dev_info.name = "block";
	q->node = node_id;
	q->node = node_id;
+5 −5
Original line number Original line Diff line number Diff line
@@ -2359,7 +2359,7 @@ static void drbd_cleanup(void)
 * @congested_data:	User data
 * @congested_data:	User data
 * @bdi_bits:		Bits the BDI flusher thread is currently interested in
 * @bdi_bits:		Bits the BDI flusher thread is currently interested in
 *
 *
 * Returns 1<<BDI_async_congested and/or 1<<BDI_sync_congested if we are congested.
 * Returns 1<<WB_async_congested and/or 1<<WB_sync_congested if we are congested.
 */
 */
static int drbd_congested(void *congested_data, int bdi_bits)
static int drbd_congested(void *congested_data, int bdi_bits)
{
{
@@ -2376,14 +2376,14 @@ static int drbd_congested(void *congested_data, int bdi_bits)
	}
	}


	if (test_bit(CALLBACK_PENDING, &first_peer_device(device)->connection->flags)) {
	if (test_bit(CALLBACK_PENDING, &first_peer_device(device)->connection->flags)) {
		r |= (1 << BDI_async_congested);
		r |= (1 << WB_async_congested);
		/* Without good local data, we would need to read from remote,
		/* Without good local data, we would need to read from remote,
		 * and that would need the worker thread as well, which is
		 * and that would need the worker thread as well, which is
		 * currently blocked waiting for that usermode helper to
		 * currently blocked waiting for that usermode helper to
		 * finish.
		 * finish.
		 */
		 */
		if (!get_ldev_if_state(device, D_UP_TO_DATE))
		if (!get_ldev_if_state(device, D_UP_TO_DATE))
			r |= (1 << BDI_sync_congested);
			r |= (1 << WB_sync_congested);
		else
		else
			put_ldev(device);
			put_ldev(device);
		r &= bdi_bits;
		r &= bdi_bits;
@@ -2399,9 +2399,9 @@ static int drbd_congested(void *congested_data, int bdi_bits)
			reason = 'b';
			reason = 'b';
	}
	}


	if (bdi_bits & (1 << BDI_async_congested) &&
	if (bdi_bits & (1 << WB_async_congested) &&
	    test_bit(NET_CONGESTED, &first_peer_device(device)->connection->flags)) {
	    test_bit(NET_CONGESTED, &first_peer_device(device)->connection->flags)) {
		r |= (1 << BDI_async_congested);
		r |= (1 << WB_async_congested);
		reason = reason == 'b' ? 'a' : 'n';
		reason = reason == 'b' ? 'a' : 'n';
	}
	}


+1 −1
Original line number Original line Diff line number Diff line
@@ -2074,7 +2074,7 @@ static int dm_any_congested(void *congested_data, int bdi_bits)
			 * the query about congestion status of request_queue
			 * the query about congestion status of request_queue
			 */
			 */
			if (dm_request_based(md))
			if (dm_request_based(md))
				r = md->queue->backing_dev_info.state &
				r = md->queue->backing_dev_info.wb.state &
				    bdi_bits;
				    bdi_bits;
			else
			else
				r = dm_table_any_congested(map, bdi_bits);
				r = dm_table_any_congested(map, bdi_bits);
+2 −2
Original line number Original line Diff line number Diff line
@@ -745,7 +745,7 @@ static int raid1_congested(struct mddev *mddev, int bits)
	struct r1conf *conf = mddev->private;
	struct r1conf *conf = mddev->private;
	int i, ret = 0;
	int i, ret = 0;


	if ((bits & (1 << BDI_async_congested)) &&
	if ((bits & (1 << WB_async_congested)) &&
	    conf->pending_count >= max_queued_requests)
	    conf->pending_count >= max_queued_requests)
		return 1;
		return 1;


@@ -760,7 +760,7 @@ static int raid1_congested(struct mddev *mddev, int bits)
			/* Note the '|| 1' - when read_balance prefers
			/* Note the '|| 1' - when read_balance prefers
			 * non-congested targets, it can be removed
			 * non-congested targets, it can be removed
			 */
			 */
			if ((bits & (1<<BDI_async_congested)) || 1)
			if ((bits & (1 << WB_async_congested)) || 1)
				ret |= bdi_congested(&q->backing_dev_info, bits);
				ret |= bdi_congested(&q->backing_dev_info, bits);
			else
			else
				ret &= bdi_congested(&q->backing_dev_info, bits);
				ret &= bdi_congested(&q->backing_dev_info, bits);
+1 −1
Original line number Original line Diff line number Diff line
@@ -914,7 +914,7 @@ static int raid10_congested(struct mddev *mddev, int bits)
	struct r10conf *conf = mddev->private;
	struct r10conf *conf = mddev->private;
	int i, ret = 0;
	int i, ret = 0;


	if ((bits & (1 << BDI_async_congested)) &&
	if ((bits & (1 << WB_async_congested)) &&
	    conf->pending_count >= max_queued_requests)
	    conf->pending_count >= max_queued_requests)
		return 1;
		return 1;


Loading