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

Commit 6a99ee6b authored by Gabriel Krisman Bertazi's avatar Gabriel Krisman Bertazi Committed by Greg Kroah-Hartman
Browse files

dm mpath: pass IO start time to path selector



[ Upstream commit 087615bf3acdafd0ba7c7c9ed5286e7b7c80fe1b ]

The HST path selector needs this information to perform path
prediction. For request-based mpath, struct request's io_start_time_ns
is used, while for bio-based, use the start_time stored in dm_io.

Signed-off-by: default avatarGabriel Krisman Bertazi <krisman@collabora.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
Stable-dep-of: 1e1fd567d32f ("dm suspend: return -ERESTARTSYS instead of -EINTR")
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 8adc9ab5
Loading
Loading
Loading
Loading
+6 −3
Original line number Original line Diff line number Diff line
@@ -558,7 +558,8 @@ static void multipath_release_clone(struct request *clone,
		if (pgpath && pgpath->pg->ps.type->end_io)
		if (pgpath && pgpath->pg->ps.type->end_io)
			pgpath->pg->ps.type->end_io(&pgpath->pg->ps,
			pgpath->pg->ps.type->end_io(&pgpath->pg->ps,
						    &pgpath->path,
						    &pgpath->path,
						    mpio->nr_bytes);
						    mpio->nr_bytes,
						    clone->io_start_time_ns);
	}
	}


	blk_put_request(clone);
	blk_put_request(clone);
@@ -1568,7 +1569,8 @@ static int multipath_end_io(struct dm_target *ti, struct request *clone,
		struct path_selector *ps = &pgpath->pg->ps;
		struct path_selector *ps = &pgpath->pg->ps;


		if (ps->type->end_io)
		if (ps->type->end_io)
			ps->type->end_io(ps, &pgpath->path, mpio->nr_bytes);
			ps->type->end_io(ps, &pgpath->path, mpio->nr_bytes,
					 clone->io_start_time_ns);
	}
	}


	return r;
	return r;
@@ -1612,7 +1614,8 @@ static int multipath_end_io_bio(struct dm_target *ti, struct bio *clone,
		struct path_selector *ps = &pgpath->pg->ps;
		struct path_selector *ps = &pgpath->pg->ps;


		if (ps->type->end_io)
		if (ps->type->end_io)
			ps->type->end_io(ps, &pgpath->path, mpio->nr_bytes);
			ps->type->end_io(ps, &pgpath->path, mpio->nr_bytes,
					 dm_start_time_ns_from_clone(clone));
	}
	}


	return r;
	return r;
+1 −1
Original line number Original line Diff line number Diff line
@@ -74,7 +74,7 @@ struct path_selector_type {
	int (*start_io) (struct path_selector *ps, struct dm_path *path,
	int (*start_io) (struct path_selector *ps, struct dm_path *path,
			 size_t nr_bytes);
			 size_t nr_bytes);
	int (*end_io) (struct path_selector *ps, struct dm_path *path,
	int (*end_io) (struct path_selector *ps, struct dm_path *path,
		       size_t nr_bytes);
		       size_t nr_bytes, u64 start_time);
};
};


/* Register a path selector */
/* Register a path selector */
+1 −1
Original line number Original line Diff line number Diff line
@@ -227,7 +227,7 @@ static int ql_start_io(struct path_selector *ps, struct dm_path *path,
}
}


static int ql_end_io(struct path_selector *ps, struct dm_path *path,
static int ql_end_io(struct path_selector *ps, struct dm_path *path,
		     size_t nr_bytes)
		     size_t nr_bytes, u64 start_time)
{
{
	struct path_info *pi = path->pscontext;
	struct path_info *pi = path->pscontext;


+1 −1
Original line number Original line Diff line number Diff line
@@ -309,7 +309,7 @@ static int st_start_io(struct path_selector *ps, struct dm_path *path,
}
}


static int st_end_io(struct path_selector *ps, struct dm_path *path,
static int st_end_io(struct path_selector *ps, struct dm_path *path,
		     size_t nr_bytes)
		     size_t nr_bytes, u64 start_time)
{
{
	struct path_info *pi = path->pscontext;
	struct path_info *pi = path->pscontext;


+9 −0
Original line number Original line Diff line number Diff line
@@ -659,6 +659,15 @@ static bool md_in_flight(struct mapped_device *md)
		return md_in_flight_bios(md);
		return md_in_flight_bios(md);
}
}


u64 dm_start_time_ns_from_clone(struct bio *bio)
{
	struct dm_target_io *tio = container_of(bio, struct dm_target_io, clone);
	struct dm_io *io = tio->io;

	return jiffies_to_nsecs(io->start_time);
}
EXPORT_SYMBOL_GPL(dm_start_time_ns_from_clone);

static void start_io_acct(struct dm_io *io)
static void start_io_acct(struct dm_io *io)
{
{
	struct mapped_device *md = io->md;
	struct mapped_device *md = io->md;
Loading