Re: [RFC PATCH v2 5/5] btrfs: implement RWF_ENCODED writes

2019-10-21 Thread Omar Sandoval
On Mon, Oct 21, 2019 at 03:14:52PM +0200, David Sterba wrote: > On Fri, Oct 18, 2019 at 03:55:13PM -0700, Omar Sandoval wrote: > > > > + nr_pages = (disk_num_bytes + PAGE_SIZE - 1) >> PAGE_SHIFT; > > > > > > nit: nr_pages = DIV_ROUND_UP(disk_num_bytes, PAGE_SIZE) > > > > disk_num_bytes is a

Re: [RFC PATCH v2 5/5] btrfs: implement RWF_ENCODED writes

2019-10-21 Thread David Sterba
On Fri, Oct 18, 2019 at 03:55:13PM -0700, Omar Sandoval wrote: > > > + nr_pages = (disk_num_bytes + PAGE_SIZE - 1) >> PAGE_SHIFT; > > > > nit: nr_pages = DIV_ROUND_UP(disk_num_bytes, PAGE_SIZE) > > disk_num_bytes is a u64, so that would expand to a 64-bit division. The > compiler is probably smar

Re: [RFC PATCH v2 5/5] btrfs: implement RWF_ENCODED writes

2019-10-18 Thread Omar Sandoval
On Fri, Oct 18, 2019 at 03:55:13PM -0700, Omar Sandoval wrote: > On Wed, Oct 16, 2019 at 01:44:56PM +0300, Nikolay Borisov wrote: > > > > > > On 15.10.19 г. 21:42 ч., Omar Sandoval wrote: > > > From: Omar Sandoval > > > > > > The implementation resembles direct I/O: we have to flush any ordered

Re: [RFC PATCH v2 5/5] btrfs: implement RWF_ENCODED writes

2019-10-18 Thread Omar Sandoval
On Wed, Oct 16, 2019 at 01:44:56PM +0300, Nikolay Borisov wrote: > > > On 15.10.19 г. 21:42 ч., Omar Sandoval wrote: > > From: Omar Sandoval > > > > The implementation resembles direct I/O: we have to flush any ordered > > extents, invalidate the page cache, and do the io tree/delalloc/extent >

Re: [RFC PATCH v2 5/5] btrfs: implement RWF_ENCODED writes

2019-10-16 Thread Nikolay Borisov
On 15.10.19 г. 21:42 ч., Omar Sandoval wrote: > From: Omar Sandoval > > The implementation resembles direct I/O: we have to flush any ordered > extents, invalidate the page cache, and do the io tree/delalloc/extent > map/ordered extent dance. From there, we can reuse the compression code > wit

[RFC PATCH v2 5/5] btrfs: implement RWF_ENCODED writes

2019-10-15 Thread Omar Sandoval
From: Omar Sandoval The implementation resembles direct I/O: we have to flush any ordered extents, invalidate the page cache, and do the io tree/delalloc/extent map/ordered extent dance. From there, we can reuse the compression code with a minor modification to distinguish the write from writebac