Re: [Cluster-devel] [PATCH V10 05/19] block: introduce bvec_last_segment()

2018-11-19 Thread Ming Lei
On Thu, Nov 15, 2018 at 03:23:56PM -0800, Omar Sandoval wrote: > On Thu, Nov 15, 2018 at 04:52:52PM +0800, Ming Lei wrote: > > BTRFS and guard_bio_eod() need to get the last singlepage segment > > from one multipage bvec, so introduce this helper to make them happy. > > > > Cc: Dave Chinner > > C

Re: [Cluster-devel] [PATCH V10 05/19] block: introduce bvec_last_segment()

2018-11-16 Thread Christoph Hellwig
> + unsigned last_page = total / PAGE_SIZE; > + > + if (last_page * PAGE_SIZE == total) Not sure it matters much with modern compilers, but generally we shit by PAGE_SHIFT instead of multiplying with or dividing by PAGE_SIZE.

Re: [Cluster-devel] [PATCH V10 05/19] block: introduce bvec_last_segment()

2018-11-15 Thread Omar Sandoval
On Thu, Nov 15, 2018 at 04:52:52PM +0800, Ming Lei wrote: > BTRFS and guard_bio_eod() need to get the last singlepage segment > from one multipage bvec, so introduce this helper to make them happy. > > Cc: Dave Chinner > Cc: Kent Overstreet > Cc: Mike Snitzer > Cc: dm-de...@redhat.com > Cc: Ale