Re: [PATCH] DAX: enable iostat for read/write
On Mon, 2016-10-17 at 11:55 -0700, Dan Williams wrote: > On Mon, Oct 17, 2016 at 10:40 AM, Kani, Toshimitsum> wrote: > > > > On Sat, 2016-10-15 at 18:54 +1100, Dave Chinner wrote: > > > > > > On Fri, Oct 14, 2016 at 11:25:13AM -0600, Toshi Kani wrote: > > : > > > > > > > > > > > +static void dax_iostat_start(struct gendisk *disk, struct > > > > iov_iter > > > > *iter, > > > > + unsigned long *start) > > > > +{ > > > > +int rw = iov_iter_rw(iter); > > > > +int sec = iov_iter_count(iter) >> 9; > > > > +int cpu = part_stat_lock(); > > > > + > > > > +*start = jiffies; > > > > +part_round_stats(cpu, >part0); > > > > +part_stat_inc(cpu, >part0, ios[rw]); > > > > +part_stat_add(cpu, >part0, sectors[rw], sec); > > > > +part_inc_in_flight(>part0, rw); > > > > +part_stat_unlock(); > > > > +} > > > > > > Why reimplement generic_start_io_acct() and > > > generic_end_io_acct()? > > > > It was modeled after __nd_iostat_start() / nd_iostart_end(). I > > agree that we can use generic_start_io_acct() and > > generic_end_io_acct() here. > > > > Should we also change the nd interface to use the generic version > > as well? > > Yes, sounds good to me. Will do. Thanks! -Toshi
Re: [PATCH] DAX: enable iostat for read/write
On Mon, 2016-10-17 at 11:55 -0700, Dan Williams wrote: > On Mon, Oct 17, 2016 at 10:40 AM, Kani, Toshimitsu m> wrote: > > > > On Sat, 2016-10-15 at 18:54 +1100, Dave Chinner wrote: > > > > > > On Fri, Oct 14, 2016 at 11:25:13AM -0600, Toshi Kani wrote: > > : > > > > > > > > > > > +static void dax_iostat_start(struct gendisk *disk, struct > > > > iov_iter > > > > *iter, > > > > + unsigned long *start) > > > > +{ > > > > +int rw = iov_iter_rw(iter); > > > > +int sec = iov_iter_count(iter) >> 9; > > > > +int cpu = part_stat_lock(); > > > > + > > > > +*start = jiffies; > > > > +part_round_stats(cpu, >part0); > > > > +part_stat_inc(cpu, >part0, ios[rw]); > > > > +part_stat_add(cpu, >part0, sectors[rw], sec); > > > > +part_inc_in_flight(>part0, rw); > > > > +part_stat_unlock(); > > > > +} > > > > > > Why reimplement generic_start_io_acct() and > > > generic_end_io_acct()? > > > > It was modeled after __nd_iostat_start() / nd_iostart_end(). I > > agree that we can use generic_start_io_acct() and > > generic_end_io_acct() here. > > > > Should we also change the nd interface to use the generic version > > as well? > > Yes, sounds good to me. Will do. Thanks! -Toshi
Re: [PATCH] DAX: enable iostat for read/write
On Mon, Oct 17, 2016 at 10:40 AM, Kani, Toshimitsuwrote: > On Sat, 2016-10-15 at 18:54 +1100, Dave Chinner wrote: >> On Fri, Oct 14, 2016 at 11:25:13AM -0600, Toshi Kani wrote: > : >> > +static void dax_iostat_start(struct gendisk *disk, struct iov_iter >> > *iter, >> > + unsigned long *start) >> > +{ >> > +int rw = iov_iter_rw(iter); >> > +int sec = iov_iter_count(iter) >> 9; >> > +int cpu = part_stat_lock(); >> > + >> > +*start = jiffies; >> > +part_round_stats(cpu, >part0); >> > +part_stat_inc(cpu, >part0, ios[rw]); >> > +part_stat_add(cpu, >part0, sectors[rw], sec); >> > +part_inc_in_flight(>part0, rw); >> > +part_stat_unlock(); >> > +} >> >> Why reimplement generic_start_io_acct() and generic_end_io_acct()? > > It was modeled after __nd_iostat_start() / nd_iostart_end(). I agree > that we can use generic_start_io_acct() and generic_end_io_acct() here. > > Should we also change the nd interface to use the generic version as > well? Yes, sounds good to me.
Re: [PATCH] DAX: enable iostat for read/write
On Mon, Oct 17, 2016 at 10:40 AM, Kani, Toshimitsu wrote: > On Sat, 2016-10-15 at 18:54 +1100, Dave Chinner wrote: >> On Fri, Oct 14, 2016 at 11:25:13AM -0600, Toshi Kani wrote: > : >> > +static void dax_iostat_start(struct gendisk *disk, struct iov_iter >> > *iter, >> > + unsigned long *start) >> > +{ >> > +int rw = iov_iter_rw(iter); >> > +int sec = iov_iter_count(iter) >> 9; >> > +int cpu = part_stat_lock(); >> > + >> > +*start = jiffies; >> > +part_round_stats(cpu, >part0); >> > +part_stat_inc(cpu, >part0, ios[rw]); >> > +part_stat_add(cpu, >part0, sectors[rw], sec); >> > +part_inc_in_flight(>part0, rw); >> > +part_stat_unlock(); >> > +} >> >> Why reimplement generic_start_io_acct() and generic_end_io_acct()? > > It was modeled after __nd_iostat_start() / nd_iostart_end(). I agree > that we can use generic_start_io_acct() and generic_end_io_acct() here. > > Should we also change the nd interface to use the generic version as > well? Yes, sounds good to me.
Re: [PATCH] DAX: enable iostat for read/write
On Sat, 2016-10-15 at 18:54 +1100, Dave Chinner wrote: > On Fri, Oct 14, 2016 at 11:25:13AM -0600, Toshi Kani wrote: : > > +static void dax_iostat_start(struct gendisk *disk, struct iov_iter > > *iter, > > + unsigned long *start) > > +{ > > + int rw = iov_iter_rw(iter); > > + int sec = iov_iter_count(iter) >> 9; > > + int cpu = part_stat_lock(); > > + > > + *start = jiffies; > > + part_round_stats(cpu, >part0); > > + part_stat_inc(cpu, >part0, ios[rw]); > > + part_stat_add(cpu, >part0, sectors[rw], sec); > > + part_inc_in_flight(>part0, rw); > > + part_stat_unlock(); > > +} > > Why reimplement generic_start_io_acct() and generic_end_io_acct()? It was modeled after __nd_iostat_start() / nd_iostart_end(). I agree that we can use generic_start_io_acct() and generic_end_io_acct() here. Should we also change the nd interface to use the generic version as well? Thanks, -Toshi ps. Sorry I realized this comment after sending out v2...
Re: [PATCH] DAX: enable iostat for read/write
On Sat, 2016-10-15 at 18:54 +1100, Dave Chinner wrote: > On Fri, Oct 14, 2016 at 11:25:13AM -0600, Toshi Kani wrote: : > > +static void dax_iostat_start(struct gendisk *disk, struct iov_iter > > *iter, > > + unsigned long *start) > > +{ > > + int rw = iov_iter_rw(iter); > > + int sec = iov_iter_count(iter) >> 9; > > + int cpu = part_stat_lock(); > > + > > + *start = jiffies; > > + part_round_stats(cpu, >part0); > > + part_stat_inc(cpu, >part0, ios[rw]); > > + part_stat_add(cpu, >part0, sectors[rw], sec); > > + part_inc_in_flight(>part0, rw); > > + part_stat_unlock(); > > +} > > Why reimplement generic_start_io_acct() and generic_end_io_acct()? It was modeled after __nd_iostat_start() / nd_iostart_end(). I agree that we can use generic_start_io_acct() and generic_end_io_acct() here. Should we also change the nd interface to use the generic version as well? Thanks, -Toshi ps. Sorry I realized this comment after sending out v2...
Re: [PATCH] DAX: enable iostat for read/write
On Fri, Oct 14, 2016 at 11:25:13AM -0600, Toshi Kani wrote: > DAX IO path does not support iostat, but its metadata IO path does. > Therefore, iostat shows metadata IO statistics only, which has been > confusing to users. > > Add iostat support to the DAX read/write path. > > Note, iostat still does not support the DAX mmap path as it allows > user applications to access directly. > > Signed-off-by: Toshi Kani> Cc: Andrew Morton > Cc: Alexander Viro > Cc: Dan Williams > Cc: Ross Zwisler > --- > fs/dax.c | 37 + > 1 file changed, 37 insertions(+) > > diff --git a/fs/dax.c b/fs/dax.c > index 014defd..3c2 100644 > --- a/fs/dax.c > +++ b/fs/dax.c > @@ -144,6 +144,34 @@ static sector_t to_sector(const struct buffer_head *bh, > return sector; > } > > +static void dax_iostat_start(struct gendisk *disk, struct iov_iter *iter, > + unsigned long *start) > +{ > + int rw = iov_iter_rw(iter); > + int sec = iov_iter_count(iter) >> 9; > + int cpu = part_stat_lock(); > + > + *start = jiffies; > + part_round_stats(cpu, >part0); > + part_stat_inc(cpu, >part0, ios[rw]); > + part_stat_add(cpu, >part0, sectors[rw], sec); > + part_inc_in_flight(>part0, rw); > + part_stat_unlock(); > +} Why reimplement generic_start_io_acct() and generic_end_io_acct()? -Dave. -- Dave Chinner da...@fromorbit.com
Re: [PATCH] DAX: enable iostat for read/write
On Fri, Oct 14, 2016 at 11:25:13AM -0600, Toshi Kani wrote: > DAX IO path does not support iostat, but its metadata IO path does. > Therefore, iostat shows metadata IO statistics only, which has been > confusing to users. > > Add iostat support to the DAX read/write path. > > Note, iostat still does not support the DAX mmap path as it allows > user applications to access directly. > > Signed-off-by: Toshi Kani > Cc: Andrew Morton > Cc: Alexander Viro > Cc: Dan Williams > Cc: Ross Zwisler > --- > fs/dax.c | 37 + > 1 file changed, 37 insertions(+) > > diff --git a/fs/dax.c b/fs/dax.c > index 014defd..3c2 100644 > --- a/fs/dax.c > +++ b/fs/dax.c > @@ -144,6 +144,34 @@ static sector_t to_sector(const struct buffer_head *bh, > return sector; > } > > +static void dax_iostat_start(struct gendisk *disk, struct iov_iter *iter, > + unsigned long *start) > +{ > + int rw = iov_iter_rw(iter); > + int sec = iov_iter_count(iter) >> 9; > + int cpu = part_stat_lock(); > + > + *start = jiffies; > + part_round_stats(cpu, >part0); > + part_stat_inc(cpu, >part0, ios[rw]); > + part_stat_add(cpu, >part0, sectors[rw], sec); > + part_inc_in_flight(>part0, rw); > + part_stat_unlock(); > +} Why reimplement generic_start_io_acct() and generic_end_io_acct()? -Dave. -- Dave Chinner da...@fromorbit.com
Re: [PATCH] DAX: enable iostat for read/write
On Fri, 2016-10-14 at 10:35 -0700, Dan Williams wrote: > On Fri, Oct 14, 2016 at 10:25 AM, Toshi Kani> wrote: > > > > DAX IO path does not support iostat, but its metadata IO path does. > > Therefore, iostat shows metadata IO statistics only, which has been > > confusing to users. > > > > Add iostat support to the DAX read/write path. > > > > Note, iostat still does not support the DAX mmap path as it allows > > user applications to access directly. > > > > Signed-off-by: Toshi Kani > > Cc: Andrew Morton > > Cc: Alexander Viro > > Cc: Dan Williams > > Cc: Ross Zwisler > > --- > > fs/dax.c | 37 + > > 1 file changed, 37 insertions(+) > > > > diff --git a/fs/dax.c b/fs/dax.c > > index 014defd..3c2 100644 > > --- a/fs/dax.c > > +++ b/fs/dax.c > > @@ -144,6 +144,34 @@ static sector_t to_sector(const struct > > buffer_head *bh, > > return sector; > > } > > > > +static void dax_iostat_start(struct gendisk *disk, struct iov_iter > > *iter, > > +unsigned long *start) > > +{ > > + int rw = iov_iter_rw(iter); > > + int sec = iov_iter_count(iter) >> 9; > > Should this be a minimum of one sector since we allow unaligned > transfers through this interface? > > ...or is iov_iter_count() somehow guaranteed to be sector aligned > here? You are right. I will update to set a minimum of one sector in v2. Thanks! -Toshi
Re: [PATCH] DAX: enable iostat for read/write
On Fri, 2016-10-14 at 10:35 -0700, Dan Williams wrote: > On Fri, Oct 14, 2016 at 10:25 AM, Toshi Kani > wrote: > > > > DAX IO path does not support iostat, but its metadata IO path does. > > Therefore, iostat shows metadata IO statistics only, which has been > > confusing to users. > > > > Add iostat support to the DAX read/write path. > > > > Note, iostat still does not support the DAX mmap path as it allows > > user applications to access directly. > > > > Signed-off-by: Toshi Kani > > Cc: Andrew Morton > > Cc: Alexander Viro > > Cc: Dan Williams > > Cc: Ross Zwisler > > --- > > fs/dax.c | 37 + > > 1 file changed, 37 insertions(+) > > > > diff --git a/fs/dax.c b/fs/dax.c > > index 014defd..3c2 100644 > > --- a/fs/dax.c > > +++ b/fs/dax.c > > @@ -144,6 +144,34 @@ static sector_t to_sector(const struct > > buffer_head *bh, > > return sector; > > } > > > > +static void dax_iostat_start(struct gendisk *disk, struct iov_iter > > *iter, > > +unsigned long *start) > > +{ > > + int rw = iov_iter_rw(iter); > > + int sec = iov_iter_count(iter) >> 9; > > Should this be a minimum of one sector since we allow unaligned > transfers through this interface? > > ...or is iov_iter_count() somehow guaranteed to be sector aligned > here? You are right. I will update to set a minimum of one sector in v2. Thanks! -Toshi
Re: [PATCH] DAX: enable iostat for read/write
On Fri, Oct 14, 2016 at 10:25 AM, Toshi Kaniwrote: > DAX IO path does not support iostat, but its metadata IO path does. > Therefore, iostat shows metadata IO statistics only, which has been > confusing to users. > > Add iostat support to the DAX read/write path. > > Note, iostat still does not support the DAX mmap path as it allows > user applications to access directly. > > Signed-off-by: Toshi Kani > Cc: Andrew Morton > Cc: Alexander Viro > Cc: Dan Williams > Cc: Ross Zwisler > --- > fs/dax.c | 37 + > 1 file changed, 37 insertions(+) > > diff --git a/fs/dax.c b/fs/dax.c > index 014defd..3c2 100644 > --- a/fs/dax.c > +++ b/fs/dax.c > @@ -144,6 +144,34 @@ static sector_t to_sector(const struct buffer_head *bh, > return sector; > } > > +static void dax_iostat_start(struct gendisk *disk, struct iov_iter *iter, > +unsigned long *start) > +{ > + int rw = iov_iter_rw(iter); > + int sec = iov_iter_count(iter) >> 9; Should this be a minimum of one sector since we allow unaligned transfers through this interface? ...or is iov_iter_count() somehow guaranteed to be sector aligned here?
Re: [PATCH] DAX: enable iostat for read/write
On Fri, Oct 14, 2016 at 10:25 AM, Toshi Kani wrote: > DAX IO path does not support iostat, but its metadata IO path does. > Therefore, iostat shows metadata IO statistics only, which has been > confusing to users. > > Add iostat support to the DAX read/write path. > > Note, iostat still does not support the DAX mmap path as it allows > user applications to access directly. > > Signed-off-by: Toshi Kani > Cc: Andrew Morton > Cc: Alexander Viro > Cc: Dan Williams > Cc: Ross Zwisler > --- > fs/dax.c | 37 + > 1 file changed, 37 insertions(+) > > diff --git a/fs/dax.c b/fs/dax.c > index 014defd..3c2 100644 > --- a/fs/dax.c > +++ b/fs/dax.c > @@ -144,6 +144,34 @@ static sector_t to_sector(const struct buffer_head *bh, > return sector; > } > > +static void dax_iostat_start(struct gendisk *disk, struct iov_iter *iter, > +unsigned long *start) > +{ > + int rw = iov_iter_rw(iter); > + int sec = iov_iter_count(iter) >> 9; Should this be a minimum of one sector since we allow unaligned transfers through this interface? ...or is iov_iter_count() somehow guaranteed to be sector aligned here?