Re: [PATCH] proc: avoid extra pde_put() in proc_fill_super()

2013-01-24 Thread Maxim Patlasov
Hi Al, 01/23/2013 08:17 PM, Al Viro wrote: > On Tue, Jan 22, 2013 at 09:03:26PM +0400, Maxim Patlasov wrote: >> If proc_get_inode() succeeded, but d_make_root() failed, pde_put() for >> proc_root will be called twice: the first time due to iput() called from >> d_make_root(

[PATCH v3 00/12] fuse: optimize scatter-gather direct IO

2012-10-26 Thread Maxim Patlasov
e_get_fr_sz() to fuse_get_user_size() - simplified loop in fuse_page_descs_length_init() - rebased on v3.7-rc2 Thanks, Maxim --- Maxim Patlasov (12): fuse: general infrastructure for pages[] of variable size fuse: categorize fuse_get_req() fuse: rework fuse_retrieve() fuse:

[PATCH 01/12] fuse: general infrastructure for pages[] of variable size

2012-10-26 Thread Maxim Patlasov
ges needed explicitly. The patch doesn't make any logic changes. Signed-off-by: Maxim Patlasov --- fs/fuse/dev.c| 47 ++- fs/fuse/file.c |4 ++-- fs/fuse/fuse_i.h | 15 --- fs/fuse/inode.c |4 ++-- 4 files cha

[PATCH 02/12] fuse: categorize fuse_get_req()

2012-10-26 Thread Maxim Patlasov
) scattered over code. Now it's clear from the first glance when a caller need fuse_req with page pointers. The patch doesn't make any logic changes. In multi-page case, it silly allocates array of FUSE_MAX_PAGES_PER_REQ page pointers. This will be amended by future patches. Signed-o

[PATCH 03/12] fuse: rework fuse_retrieve()

2012-10-26 Thread Maxim Patlasov
off-by: Maxim Patlasov --- fs/fuse/dev.c | 25 +++-- 1 files changed, 15 insertions(+), 10 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index a5d4440..1266a5c 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -1563,13 +1563,24 @@ static int fuse_retrieve(

[PATCH 04/12] fuse: rework fuse_readpages()

2012-10-26 Thread Maxim Patlasov
The patch uses 'nr_pages' argument of fuse_readpages() as heuristics for the number of page pointers to allocate. This can be improved further by taking in consideration fc->max_read and gaps between page indices, but it's not clear whether it's worthy or not. Signed

[PATCH 05/12] fuse: rework fuse_perform_write()

2012-10-26 Thread Maxim Patlasov
The patch allocates as many page pointers in fuse_req as needed to cover interval [pos .. pos+len-1]. Inline helper fuse_wr_pages() is introduced to hide this cumbersome arithmetic. Signed-off-by: Maxim Patlasov --- fs/fuse/file.c | 13 +++-- 1 files changed, 11 insertions(+), 2

[PATCH 06/12] fuse: rework fuse_do_ioctl()

2012-10-26 Thread Maxim Patlasov
fuse_do_ioctl() already calculates the number of pages it's going to use. It is stored in 'num_pages' variable. So the patch simply uses it for allocating fuse_req. Signed-off-by: Maxim Patlasov --- fs/fuse/file.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff

[PATCH 07/12] fuse: add per-page descriptor to fuse_req

2012-10-26 Thread Maxim Patlasov
The ability to save page pointers along with lengths and offsets in fuse_req will be useful to cover several iovec-s with a single fuse_req. Per-request page_offset is removed because anybody who need it can use req->page_descs[0].offset instead. Signed-off-by: Maxim Patlasov --- fs/fuse/de

[PATCH 08/12] fuse: use req->page_descs[] for argpages cases

2012-10-26 Thread Maxim Patlasov
gments described by req->page_descs[]. This will be useful for next patches optimizing direct_IO. Signed-off-by: Maxim Patlasov --- fs/fuse/cuse.c |1 + fs/fuse/dev.c |7 +++ fs/fuse/dir.c |1 + fs/fuse/file.c | 20 4 files changed, 25 insertions(+)

[PATCH 09/12] mm: minor cleanup of iov_iter_single_seg_count()

2012-10-26 Thread Maxim Patlasov
The function does not modify iov_iter which 'i' points to. Signed-off-by: Maxim Patlasov --- include/linux/fs.h |2 +- mm/filemap.c |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/fs.h b/include/linux/fs.h index b33cfc9..8967baa 10

[PATCH 10/12] fuse: pass iov[] to fuse_get_user_pages()

2012-10-26 Thread Maxim Patlasov
(). Signed-off-by: Maxim Patlasov --- fs/fuse/file.c | 103 +++- 1 files changed, 49 insertions(+), 54 deletions(-) diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 51996af..9934321 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -1056,14

[PATCH 11/12] fuse: optimize fuse_get_user_pages()

2012-10-26 Thread Maxim Patlasov
Let fuse_get_user_pages() pack as many iov-s to a single fuse_req as possible. This is very beneficial in case of iov[] consisting of many iov-s of relatively small sizes (e.g. PAGE_SIZE). Signed-off-by: Maxim Patlasov --- fs/fuse/file.c | 79

[PATCH 12/12] fuse: optimize __fuse_direct_io()

2012-10-26 Thread Maxim Patlasov
e. Signed-off-by: Maxim Patlasov --- fs/fuse/file.c | 25 + 1 files changed, 21 insertions(+), 4 deletions(-) diff --git a/fs/fuse/file.c b/fs/fuse/file.c index fad8c7b..1a9ae5a 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -1088,14 +1088,14 @@ static int fuse_get_

[PATCH] fuse: hotfix truncate_pagecache() issue

2013-08-28 Thread Maxim Patlasov
ostpone it until the issue is well discussed on the mailing list(s). Signed-off-by: Maxim Patlasov --- fs/fuse/dir.c|7 ++- fs/fuse/file.c |8 +++- fs/fuse/fuse_i.h |2 ++ fs/fuse/inode.c |3 ++- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/fs/fuse/

Re: linux-next: build warnings after merge of the akpm-current tree

2013-08-29 Thread Maxim Patlasov
Hi Stephen, 08/29/2013 01:47 PM, Stephen Rothwell пишет: Hi Andrew, After merging the akpm tree, today's linux-next build (sparc64 defconfig and others) produced these warnings: mm/page-writeback.c: In function 'balance_dirty_pages_ratelimited': mm/page-writeback.c:1450:13: warning: 'bdi_thres

Re: [PATCH] fuse: fix race in fuse_writepages()

2013-08-29 Thread Maxim Patlasov
Hi, 08/29/2013 03:46 PM, Miklos Szeredi пишет: On Fri, Aug 16, 2013 at 03:51:41PM +0400, Maxim Patlasov wrote: The patch is for git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse.git writepages.v2 The patch fixes a race between ftruncate(2), mmap-ed write and write(2): 1) An user

Re: [PATCH] fuse: hotfix truncate_pagecache() issue

2013-08-29 Thread Maxim Patlasov
Hi, 08/29/2013 01:25 PM, Miklos Szeredi пишет: On Wed, Aug 28, 2013 at 04:21:46PM +0400, Maxim Patlasov wrote: The way how fuse calls truncate_pagecache() from fuse_change_attributes() is completely wrong. Because, w/o i_mutex held, we never sure whether 'oldsize' and 'attr->

Re: [PATCH 2/2] fuse: wait for writeback in fuse_file_fallocate() -v2

2013-08-29 Thread Maxim Patlasov
Hi, 08/29/2013 07:41 PM, Miklos Szeredi пишет: On Fri, Aug 16, 2013 at 03:30:27PM +0400, Maxim Patlasov wrote: The patch fixes a race between mmap-ed write and fallocate(PUNCH_HOLE): 1) An user makes a page dirty via mmap-ed write. 2) The user performs fallocate(2) with mode == PUNCH_HOLE

[PATCH 0/5] fuse: fixes for fuse_writepage_in_flight() and friends

2013-10-02 Thread Maxim Patlasov
Miklos, The patch-set fixes a few issues I found while reviewing your recent "fixes for writepages" patch-set. The patches are for writepages.v2. If they are OK, I'll re-check them for for-next. Thanks, Maxim --- Maxim Patlasov (5): fuse: writepages: roll back changes

[PATCH 1/5] fuse: writepages: roll back changes if request not found

2013-10-02 Thread Maxim Patlasov
ing false. Signed-off-by: Maxim Patlasov --- fs/fuse/file.c |5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 135360e..575e44f 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -1659,8 +1659,11 @@ static bool fuse_writepage_in_flig

[PATCH 2/5] fuse: writepages: crop secondary requests on send

2013-10-02 Thread Maxim Patlasov
roperly. The result would be stale data written to the server to a file offset where zeros must be. Signed-off-by: Maxim Patlasov --- fs/fuse/file.c | 63 1 file changed, 54 insertions(+), 9 deletions(-) diff --git a/fs/fuse/file.c b/fs/

[PATCH 4/5] fuse: writepage: update bdi writeout when deleting secondary request

2013-10-02 Thread Maxim Patlasov
d off completely" was handled in fuse_send_writepage() by calling fuse_writepage_finish() which updated BDI_WRITTEN unconditionally. Signed-off-by: Maxim Patlasov --- fs/fuse/file.c |6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/fuse/file.c b/fs/fuse/file.c ind

[PATCH 3/5] fuse: writepages: crop secondary requests on attach

2013-10-02 Thread Maxim Patlasov
ached request comes to fuse_send_writepage(), i_size is already extended and that stale range of a page will come to the server. The result is that the user will see stale data where zeros are expected. Signed-off-by: Maxim Patlasov --- fs/fuse/file.c | 20 +++- 1 file changed,

[PATCH 5/5] fuse: writepages: protect secondary requests from fuse file release

2013-10-02 Thread Maxim Patlasov
All async fuse requests must be supplied with extra reference to a fuse file. This is necessary to ensure that the fuse file is not released until all in-flight requests are completed. Fuse secondary writeback requests must obey this rule as well. Signed-off-by: Maxim Patlasov --- fs/fuse

[PATCH 2/5] fuse: writepages: crop secondary requests on send -v2

2013-10-02 Thread Maxim Patlasov
roperly. The result would be stale data written to the server to a file offset where zeros must be. Changed in v2: - avoid NULL pointer dereference in fuse_drop_writepage(). Signed-off-by: Maxim Patlasov --- fs/fuse/file.c | 64 1 fi

Re: [PATCH 2/5] fuse: writepages: crop secondary requests on send -v2

2013-10-02 Thread Maxim Patlasov
On 10/02/2013 07:07 PM, Miklos Szeredi wrote: On Wed, Oct 2, 2013 at 1:17 PM, Maxim Patlasov wrote: If writeback happens while fuse is in FUSE_NOWRITE condition, the request will be queued but not processed immediately (see fuse_flush_writepages()). Until FUSE_NOWRITE becomes relaxed, more

[PATCH 0/4] fuse: fixes for fuse_writepage_in_flight() and friends -v2

2013-10-02 Thread Maxim Patlasov
#x27;ll re-check > them for for-next. Thanks, Maxim --- Maxim Patlasov (4): fuse: writepages: roll back changes if request not found fuse: writepages: crop secondary requests fuse: writepage: update bdi writeout when deleting secondary request fuse: writepages: protec

[PATCH 4/4] fuse: writepages: protect secondary requests from fuse file release

2013-10-02 Thread Maxim Patlasov
All async fuse requests must be supplied with extra reference to a fuse file. This is necessary to ensure that the fuse file is not released until all in-flight requests are completed. Fuse secondary writeback requests must obey this rule as well. Signed-off-by: Maxim Patlasov --- fs/fuse

[PATCH 1/4] fuse: writepages: roll back changes if request not found

2013-10-02 Thread Maxim Patlasov
ing false. Signed-off-by: Maxim Patlasov --- fs/fuse/file.c |5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 135360e..575e44f 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -1659,8 +1659,11 @@ static bool fuse_writepage_in_flig

[PATCH 3/4] fuse: writepage: update bdi writeout when deleting secondary request

2013-10-02 Thread Maxim Patlasov
d off completely" was handled in fuse_send_writepage() by calling fuse_writepage_finish() which updated BDI_WRITTEN unconditionally. Signed-off-by: Maxim Patlasov --- fs/fuse/file.c |6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/fuse/file.c b/fs/fuse/file.c ind

[PATCH 2/4] fuse: writepages: crop secondary requests

2013-10-02 Thread Maxim Patlasov
be. Similar problem may happen if secondary requests are attached to an in-flight request that was already cropped. The patch solves the issue by cropping all secondary requests in fuse_writepage_end(). Thanks to Miklos for idea. Signed-off-by: Maxim Patlasov -

Re: [PATCH 2/4] fuse: writepages: crop secondary requests

2013-10-03 Thread Maxim Patlasov
On 10/03/2013 01:57 PM, Miklos Szeredi wrote: On Wed, Oct 02, 2013 at 09:38:32PM +0400, Maxim Patlasov wrote: If writeback happens while fuse is in FUSE_NOWRITE condition, the request will be queued but not processed immediately (see fuse_flush_writepages()). Until FUSE_NOWRITE becomes relaxed

Re: [PATCH 3/4] fuse: writepage: update bdi writeout when deleting secondary request

2013-10-03 Thread Maxim Patlasov
On 10/03/2013 02:26 PM, Miklos Szeredi wrote: On Wed, Oct 02, 2013 at 09:38:43PM +0400, Maxim Patlasov wrote: BDI_WRITTEN counter is used to estimate bdi bandwidth. It must be incremented every time as bdi ends page writeback. No matter whether it was fulfilled by actual write or by discarding

Re: [PATCH 2/4] fuse: writepages: crop secondary requests

2013-10-03 Thread Maxim Patlasov
On 10/03/2013 07:14 PM, Miklos Szeredi wrote: On Thu, Oct 03, 2013 at 05:28:30PM +0400, Maxim Patlasov wrote: 1. There is an in-flight primary request with a chain of secondary ones. 2. User calls ftruncate(2) to extend file; fuse_set_nowrite() makes fi->writectr negative and starts wait

Re: [PATCH 2/4] fuse: writepages: crop secondary requests

2013-10-03 Thread Maxim Patlasov
On 10/03/2013 08:09 PM, Miklos Szeredi wrote: On Thu, Oct 3, 2013 at 5:50 PM, Maxim Patlasov wrote: On 10/03/2013 07:14 PM, Miklos Szeredi wrote: On Thu, Oct 03, 2013 at 05:28:30PM +0400, Maxim Patlasov wrote: 1. There is an in-flight primary request with a chain of secondary ones. 2. User

[PATCH 07/16] fuse: Trust kernel i_mtime only -v2

2013-07-11 Thread Maxim Patlasov
ime. Signed-off-by: Maxim Patlasov --- fs/fuse/dir.c| 109 -- fs/fuse/file.c | 30 +-- fs/fuse/fuse_i.h |6 ++- fs/fuse/inode.c | 13 +- 4 files changed, 138 insertions(+), 20 deletions(-) diff --git a/fs/fuse/dir.c b

[PATCH 08/16] fuse: Flush files on wb close -v2

2013-07-11 Thread Maxim Patlasov
in ff->count. This delays actual close until all fuse wb is completed. In case of "write cache" turned off, the flush is ensured by fuse_vma_close(). Changed in v2: - updated patch to be applied smoothly on top of "Trust kernel i_mtime only -v2". Signed-off-by: Maxim

Re: [PATCH] mm: strictlimit feature -v3

2013-07-11 Thread Maxim Patlasov
On Thu, Jul 11, 2013 at 10:51 PM, Jan Kara wrote: > On Fri 05-07-13 19:53:36, Maxim Patlasov wrote: >> The feature prevents mistrusted filesystems to grow a large number of dirty >> pages before throttling. For such filesystems balance_dirty_pages always >> check bdi counte

Re: [PATCH 0/3] fuse: fixes for writepages

2013-09-20 Thread Maxim Patlasov
Miklos, On 09/19/2013 08:11 PM, Miklos Szeredi wrote: Maxim, Please review and test these. I've appended them to writepages.v2 and for-next. Thanks a lot for efforts. I'll start to work on it now and send you feedback as soon as I get a progress. Btw, adding fuse-devel to cc. Thanks, Max

[PATCH] writeback: fix delayed sync(2)

2013-09-20 Thread Maxim Patlasov
The patch uses queue_delayed_work for __mark_inode_dirty. This should be safe because even if queue_delayed_work returns false (if the work is already on a queue), bdi_writeback_workfn will re-schedule itself by looking at wb->b_dirty. Signed-off-by: Maxim Patlasov --- mm/backing-dev.c |

Re: [PATCH 2/2] fuse: wait for writeback in fuse_file_fallocate() -v2

2013-09-11 Thread Maxim Patlasov
On 09/11/2013 02:12 PM, Miklos Szeredi wrote: On Fri, Aug 30, 2013 at 1:33 PM, Maxim Patlasov wrote: 08/30/2013 01:13 PM, Miklos Szeredi пишет: On Thu, Aug 29, 2013 at 6:41 PM, Miklos Szeredi wrote: BTW, isn't it enough to do the filemap_write_and_wait() *plus* the fuse_set_no

[PATCH 1/2] fuse: wait for writeback in fuse_file_fallocate() -v3

2013-09-13 Thread Maxim Patlasov
-linus branch of fuse.git Signed-off-by: Maxim Patlasov --- fs/fuse/file.c | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/fs/fuse/file.c b/fs/fuse/file.c index d409dea..f9f07c4 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -2484,8 +2484,15 @@ stati

[PATCH 2/2] fuse: fix fallocate vs. ftruncate race

2013-09-13 Thread Maxim Patlasov
nded either by write(2) or ftruncate(2) or fallocate(2). > 4. mmap-ed write makes a page in the extended region dirty. This patch adds necessary bits to fuse_file_fallocate() to protect from that race. Signed-off-by: Maxim Patlasov --- fs/fuse/file.c |7 +++ 1 file changed, 7 insertio

Re: [fuse-devel] [PATCH 2/4] fuse: writepages: crop secondary requests

2013-10-09 Thread Maxim Patlasov
Hi Miklos, On 10/03/2013 08:22 PM, Maxim Patlasov wrote: On 10/03/2013 08:09 PM, Miklos Szeredi wrote: On Thu, Oct 3, 2013 at 5:50 PM, Maxim Patlasov wrote: On 10/03/2013 07:14 PM, Miklos Szeredi wrote: On Thu, Oct 03, 2013 at 05:28:30PM +0400, Maxim Patlasov wrote: 1. There is an in

Re: [fuse-devel] [PATCH 2/4] fuse: writepages: crop secondary requests

2013-10-09 Thread Maxim Patlasov
On 10/09/2013 12:20 PM, Maxim Patlasov wrote: Hi Miklos, On 10/03/2013 08:22 PM, Maxim Patlasov wrote: On 10/03/2013 08:09 PM, Miklos Szeredi wrote: On Thu, Oct 3, 2013 at 5:50 PM, Maxim Patlasov wrote: On 10/03/2013 07:14 PM, Miklos Szeredi wrote: On Thu, Oct 03, 2013 at 05:28:30PM +0400

[PATCH v6 00/11] fuse: An attempt to implement a write-back cache policy

2013-10-10 Thread Maxim Patlasov
moved restructuring fuse_readpage to a separate patch - avoided use of union for fuse_fill_data - grabbed a ref to the request in fuse_send_writepages Changed in v6: - rebased on writepages.v2 branch of the fuse tree (beba4ae4c2fda4e03a813aec640586087fa80a8b) - added waiting for fuse wri

[PATCH 01/11] fuse: Linking file to inode helper

2013-10-10 Thread Maxim Patlasov
From: Pavel Emelyanov When writeback is ON every writeable file should be in per-inode write list, not only mmap-ed ones. Thus introduce a helper for this linkage. Signed-off-by: Maxim Patlasov Signed-off-by: Pavel Emelyanov --- fs/fuse/file.c | 33 +++-- 1 file

[PATCH 03/11] fuse: Connection bit for enabling writeback

2013-10-10 Thread Maxim Patlasov
From: Pavel Emelyanov Off (0) by default. Will be used in the next patches and will be turned on at the very end. Signed-off-by: Maxim Patlasov Signed-off-by: Pavel Emelyanov --- fs/fuse/fuse_i.h |3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h

[PATCH 04/11] fuse: Trust kernel i_size only - v4

2013-10-10 Thread Maxim Patlasov
From: Pavel Emelyanov Make fuse think that when writeback is on the inode's i_size is always up-to-date and not update it with the value received from the userspace. This is done because the page cache code may update i_size without letting the FS know. This assumption implies fixing the previou

[PATCH 02/11] fuse: Prepare to handle short reads

2013-10-10 Thread Maxim Patlasov
From: Pavel Emelyanov A helper which gets called when read reports less bytes than was requested. See patch #4 (trust kernel i_size only) for details. Signed-off-by: Maxim Patlasov Signed-off-by: Pavel Emelyanov --- fs/fuse/file.c | 21 + 1 file changed, 13 insertions

[PATCH 07/11] fuse: restructure fuse_readpage()

2013-10-10 Thread Maxim Patlasov
Move the code filling and sending read request to a separate function. Future patches will use it for .write_begin -- partial modification of a page requires reading the page from the storage very similarly to what fuse_readpage does. Signed-off-by: Maxim Patlasov --- fs/fuse/file.c | 55

[PATCH 05/11] fuse: Trust kernel i_mtime only -v2

2013-10-10 Thread Maxim Patlasov
ime. Signed-off-by: Maxim Patlasov --- fs/fuse/dir.c| 109 -- fs/fuse/file.c | 30 +-- fs/fuse/fuse_i.h |6 ++- fs/fuse/inode.c | 13 +- 4 files changed, 138 insertions(+), 20 deletions(-) diff --git a/fs/fuse/dir.c b

[PATCH 06/11] fuse: Flush files on wb close -v2

2013-10-10 Thread Maxim Patlasov
Changed in v2: - updated patch to be applied smoothly on top of "Trust kernel i_mtime only -v2". Signed-off-by: Maxim Patlasov --- fs/fuse/file.c |6 ++ 1 file changed, 6 insertions(+) diff --git a/fs/fuse/file.c b/fs/fuse/file.c index eabe202..b4d4189 100644 --- a/fs/f

[PATCH 08/11] fuse: Implement write_begin/write_end callbacks -v2

2013-10-10 Thread Maxim Patlasov
t of user data by incorrect crop of a secondary request to a stale inarg->size of the primary. Signed-off-by: Maxim Patlasov --- fs/fuse/file.c | 100 1 file changed, 100 insertions(+) diff --git a/fs/fuse/file.c b/fs/fuse/file.c i

[PATCH 10/11] fuse: Fix O_DIRECT operations vs cached writeback misorder - v2

2013-10-10 Thread Maxim Patlasov
nds that reorder operation. Fix this by making the fuse direct IO callback explicitly wait on the in-flight writeback to finish. Changed in v2: - do not wait on writeback if fuse_direct_io() call came from CUSE (because it doesn't use fuse inodes) Signed-off-by: Maxim Patlasov ---

[PATCH 09/11] fuse: fuse_flush() should wait on writeback

2013-10-10 Thread Maxim Patlasov
userspace yet if we won't ensure it explicitly. Signed-off-by: Maxim Patlasov --- fs/fuse/file.c |9 + 1 file changed, 9 insertions(+) diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 642bd51..f23fc65 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -19,6 +19,7 @@ #in

[PATCH 11/11] fuse: Turn writeback cache on

2013-10-10 Thread Maxim Patlasov
d call the generic_file_aio_write to make use of the Linux page cache engine. Signed-off-by: Maxim Patlasov --- fs/fuse/file.c|5 + fs/fuse/fuse_i.h |4 fs/fuse/inode.c | 13 + include/uapi/linux/fuse.h |2 ++ 4 files changed, 24

[PATCH] fuse: Flush files on wb close -v2

2013-10-10 Thread Maxim Patlasov
in ff->count. This delays actual close until all fuse wb is completed. In case of "write cache" turned off, the flush is ensured by fuse_vma_close(). Changed in v2: - updated patch to be applied smoothly on top of "Trust kernel i_mtime only -v2". Signed-off-by: Maxim

Re: [PATCH 2/2] fuse: wait for writeback in fuse_file_fallocate() -v2

2013-08-30 Thread Maxim Patlasov
08/30/2013 01:13 PM, Miklos Szeredi пишет: On Thu, Aug 29, 2013 at 6:41 PM, Miklos Szeredi wrote: BTW, isn't it enough to do the filemap_write_and_wait() *plus* the fuse_set_nowrite()? Thought about it a bit and I think this should do fine. Any writes before the fallocate will go trough befor

[PATCH] fuse: hotfix truncate_pagecache() issue -v2

2013-08-30 Thread Maxim Patlasov
iscussed on the mailing list(s). Changed in v2: - improved patch description to cover both sides of the issue. Signed-off-by: Maxim Patlasov --- fs/fuse/dir.c|7 ++- fs/fuse/file.c |8 +++- fs/fuse/fuse_i.h |2 ++ fs/fuse/inode.c |3 ++- 4 files changed, 17 insertions(+)

Re: [PATCH 10/16] fuse: Implement writepages callback

2013-08-30 Thread Maxim Patlasov
Hi Miklos, 08/30/2013 02:12 PM, Miklos Szeredi пишет: On Fri, Aug 09, 2013 at 07:02:12PM +0400, Maxim Patlasov wrote: 08/06/2013 08:25 PM, Miklos Szeredi пишет: Hmm. Direct IO on an mmaped file will do get_user_pages() which will do the necessary page fault magic and ->page_mkwrite() will

Re: [PATCH 10/16] fuse: Implement writepages callback

2013-09-03 Thread Maxim Patlasov
09/03/2013 02:31 PM, Miklos Szeredi пишет: On Fri, Aug 30, 2013 at 06:50:18PM +0400, Maxim Patlasov wrote: Hi Miklos, 08/30/2013 02:12 PM, Miklos Szeredi пишет: On Fri, Aug 09, 2013 at 07:02:12PM +0400, Maxim Patlasov wrote: 08/06/2013 08:25 PM, Miklos Szeredi пишет: Hmm. Direct IO on an

[PATCH] ext4: avoid exposure of stale data in ext4_punch_hole()

2013-09-26 Thread Maxim Patlasov
xtent tree (or block map). In that case the user will see stale data even after fallocate is completed. Signed-off-by: Maxim Patlasov --- fs/ext4/inode.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 0d424d7..6b

Re: [PATCH] ext4: avoid exposure of stale data in ext4_punch_hole()

2013-09-27 Thread Maxim Patlasov
Hi Jan, On 09/26/2013 10:53 PM, Jan Kara wrote: Hello, On Thu 26-09-13 21:32:07, Maxim Patlasov wrote: While handling punch-hole fallocate, it's useless to truncate page cache before removing the range from extent tree (or block map in indirect case) because page cache can be re-popu

Re: [PATCH] ext4: avoid exposure of stale data in ext4_punch_hole()

2013-09-27 Thread Maxim Patlasov
Hi, On 09/27/2013 06:43 PM, Jan Kara wrote: On Fri 27-09-13 17:05:18, Maxim Patlasov wrote: On 09/26/2013 10:53 PM, Jan Kara wrote: Hello, On Thu 26-09-13 21:32:07, Maxim Patlasov wrote: While handling punch-hole fallocate, it's useless to truncate page cache before removing the

[PATCH] ext4: avoid exposure of stale data in ext4_punch_hole() -v2

2013-09-27 Thread Maxim Patlasov
other truncation of pagecache after punch hole is done. Signed-off-by: Maxim Patlasov --- fs/ext4/inode.c |6 ++ 1 file changed, 6 insertions(+) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 0d424d7..2984ddf 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -3621,6 +3621,12 @

[PATCH 0/6] fuse: allocate req->pages[] dynamically

2012-09-07 Thread Maxim Patlasov
make memory overhead worse if implemented w/o this patch-set. Thanks, Maxim --- Maxim Patlasov (6): fuse: general infrastructure for pages[] of variable size fuse: categorize fuse_get_req() fuse: rework fuse_retrieve() fuse: rework fuse_readpages() fuse: rework fuse_perf

[PATCH 1/6] fuse: general infrastructure for pages[] of variable size

2012-09-07 Thread Maxim Patlasov
The patch removes inline array of FUSE_MAX_PAGES_PER_REQ page pointers from fuse_req. Instead of that, req->pages may now point either to small inline array or to an array allocated dynamically. This essentially means that all callers of fuse_request_alloc[_nofs] should pass the number of pages ne

[PATCH 2/6] fuse: categorize fuse_get_req()

2012-09-07 Thread Maxim Patlasov
The patch categorizes all fuse_get_req() invocations into three categories: - fuse_get_req_nopages() - when caller doesn't care about req->pages - fuse_get_req_onepage() - when caller need exactly one page - fuse_get_req_multipage() - in other cases. The decision to split one fuse_get_req() int

[PATCH 3/6] fuse: rework fuse_retrieve()

2012-09-07 Thread Maxim Patlasov
The patch reworks fuse_retrieve() to allocate only so many page pointers as needed. The core part of the patch is the following calculation: num_pages = (num + offset + PAGE_SIZE - 1) >> PAGE_SHIFT; (thanks Miklos for formula). All other changes are moslty shuffling lines. The patch also

[PATCH 4/6] fuse: rework fuse_readpages()

2012-09-07 Thread Maxim Patlasov
The patch uses 'nr_pages' argument of fuse_readpages() as the heuristics for number of page pointers to allocate. This can be improved further by taking in consideration fc->max_read and gaps between page indices, but it's not clear wheteher it's worthy or not. --- fs/fuse/file.c | 10 -

[PATCH 5/6] fuse: rework fuse_perform_write()

2012-09-07 Thread Maxim Patlasov
The patch allocates as many page pointers in fuse_req as needed to cover interval [pos .. pos+len-1]. FUSE_WR_PAGES macro is introduced to hide this cumbersome arithmetics. --- fs/fuse/file.c | 15 +++ 1 files changed, 11 insertions(+), 4 deletions(-) diff --git a/fs/fuse/file.c b/f

[PATCH 6/6] fuse: rework fuse_do_ioctl()

2012-09-07 Thread Maxim Patlasov
fuse_do_ioctl() already calculates the number of pages it's going to use. It is stored in 'num_pages' variable. So the patch simply uses it for allocating fuse_req. --- fs/fuse/file.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 84

[PATCH] fuse: Trust kernel i_size only - v2

2012-12-05 Thread Maxim Patlasov
Make fuse think that when writeback is on the inode's i_size is always up-to-date and not update it with the value received from the userspace. This is done because the page cache code may update i_size without letting the FS know. This assumption implies fixing the previously introduced short-rea

[PATCH] fuse: Implement writepages and write_begin/write_end callbacks - v2

2012-12-05 Thread Maxim Patlasov
The .writepages one is required to make each writeback request carry more than one page on it. Changed in v2: - fixed fuse_prepare_write() to avoid reads beyond EOF - fixed fuse_prepare_write() to zero uninitialized part of page Original patch by: Pavel Emelyanov Signed-off-by: Maxim V. Patlas

[PATCH] fuse: Fix O_DIRECT operations vs cached writeback misorder - v2

2012-12-05 Thread Maxim Patlasov
The problem is: 1. write cached data to a file 2. read directly from the same file (via another fd) The 2nd operation may read stale data, i.e. the one that was in a file before the 1st op. Problem is in how fuse manages writeback. When direct op occurs the core kernel code calls filemap_write_a

[PATCH 0/3] fuse: fix accounting background requests

2012-12-26 Thread Maxim Patlasov
request_end() wakes up a waiter, the waiter allocates new request and submits it for background processing, the processing ends in request_end() where another wakeup happens an so on. Thanks, Maxim --- Maxim Patlasov (3): fuse: make request allocations for background processing explicit

[PATCH 1/3] fuse: make request allocations for background processing explicit

2012-12-26 Thread Maxim Patlasov
req() aware about the type. Next patches will use it. Signed-off-by: Maxim Patlasov --- fs/fuse/cuse.c |2 +- fs/fuse/dev.c| 22 +++--- fs/fuse/file.c |5 +++-- fs/fuse/fuse_i.h |3 +++ fs/fuse/inode.c |1 + 5 files changed, 27 insertions(+), 6 deleti

[PATCH 2/3] fuse: skip blocking on allocations of synchronous requests

2012-12-26 Thread Maxim Patlasov
Miklos wrote: > A task may have at most one synchronous request allocated. So these > requests need not be otherwise limited. The patch re-works fuse_get_req() to follow this idea. Signed-off-by: Maxim Patlasov --- fs/fuse/dev.c | 21 + 1 files changed, 13 inse

[PATCH 3/3] fuse: implement exclusive wakeup for blocked_waitq

2012-12-26 Thread Maxim Patlasov
The patch solves thundering herd problem. So far as previous patches ensured that only allocations for background may block, it's safe to wake up one waiter. Whoever it is, it will wake up another one in request_end() afterwards. Signed-off-by: Maxim Patlasov --- fs/fuse/dev.c |

[PATCH 0/5] fuse: close file synchronously

2012-12-20 Thread Maxim Patlasov
ges_end) cannot trigger FUSE_RELEASE anymore. Hence, we'll never block in contexts other than close(). Thanks, Maxim --- Maxim Patlasov (5): fuse: add close_wait flag to fuse_conn fuse: cosmetic rework of fuse_send_readpages fuse: wait for end of IO on release fuse: enabl

[PATCH 1/5] fuse: add close_wait flag to fuse_conn

2012-12-20 Thread Maxim Patlasov
The feature will be governed by fc->close_wait. Userspace can enable it in the same way as auto_inval_data or any other kernel fuse capability. Signed-off-by: Maxim Patlasov --- fs/fuse/fuse_i.h |3 +++ fs/fuse/inode.c |5 - include/uapi/linux/fuse.h |

[PATCH 2/5] fuse: cosmetic rework of fuse_send_readpages

2012-12-20 Thread Maxim Patlasov
The patch change arguments of fuse_send_readpages to give it access to inode (will be used in the next patch of patch-set). The change is cosmetic, no logic changed. Signed-off-by: Maxim Patlasov --- fs/fuse/file.c | 20 +++- 1 files changed, 11 insertions(+), 9 deletions

[PATCH 3/5] fuse: wait for end of IO on release

2012-12-20 Thread Maxim Patlasov
async I/O, its callbacks (fuse_readpages_end and fuse_writepage_finish) calling fuse_file_put cannot be the last holders of fuse file anymore. To emphasize the fact, the patch replaces fuse_file_put with __fuse_file_put there. Signed-off-by: Maxim Patlasov --- fs/fuse/fil

[PATCH 4/5] fuse: enable close_wait feature

2012-12-20 Thread Maxim Patlasov
callback. Now, it's always safe because callbacks don't send requests to userspace anymore. Signed-off-by: Maxim Patlasov --- fs/fuse/file.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/fs/fuse/file.c b/fs/fuse/file.c index aed9be2..dac3a7c 100644 --- a/fs/fu

[PATCH 5/5] fuse: fix synchronous case of fuse_file_put()

2012-12-20 Thread Maxim Patlasov
If fuse_file_put() is called with sync==true, the user may be blocked for a while, until userspace ACKs our FUSE_RELEASE request. This blocking must be uninterruptible. Otherwise request could be interrupted, but file association in user space remains. Signed-off-by: Maxim Patlasov --- fs/fuse

[PATCH v2 00/14] fuse: An attempt to implement a write-back cache policy

2012-11-16 Thread Maxim Patlasov
lligently if writeback cache is on (see patch #7 (update i_mtime on buffered writes) for details. - put enabling writeback cache under fusermount control; (see mount option 'allow_wbcache' introduced by patch #13 (turn writeback cache on)) - rebased on v3.7-rc5 Thanks, Maxim

[PATCH 01/14] fuse: Linking file to inode helper

2012-11-16 Thread Maxim Patlasov
When writeback is ON every writeable file should be in per-inode write list, not only mmap-ed ones. Thus introduce a helper for this linkage. Signed-off-by: Maxim Patlasov Signed-off-by: Pavel Emelyanov --- fs/fuse/file.c | 33 +++-- 1 files changed, 19 insertions

[PATCH 02/14] fuse: Getting file for writeback helper

2012-11-16 Thread Maxim Patlasov
There will be a .writepageS callback implementation which will need to get a fuse_file out of a fuse_inode, thus make a helper for this. Signed-off-by: Maxim Patlasov Signed-off-by: Pavel Emelyanov --- fs/fuse/file.c | 24 1 files changed, 16 insertions(+), 8

[PATCH 03/14] fuse: Prepare to handle short reads

2012-11-16 Thread Maxim Patlasov
A helper which gets called when read reports less bytes than was requested. See patch #6 (trust kernel i_size only) for details. Signed-off-by: Maxim Patlasov Signed-off-by: Pavel Emelyanov --- fs/fuse/file.c | 21 + 1 files changed, 13 insertions(+), 8 deletions(-) diff

[PATCH 04/14] fuse: Prepare to handle multiple pages in writeback

2012-11-16 Thread Maxim Patlasov
The .writepages callback will issue writeback requests with more than one page aboard. Make existing end/check code be aware of this. Original patch by: Pavel Emelyanov Signed-off-by: Maxim Patlasov --- fs/fuse/file.c | 22 +++--- 1 files changed, 15 insertions(+), 7

[PATCH 05/14] fuse: Connection bit for enabling writeback

2012-11-16 Thread Maxim Patlasov
Off (0) by default. Will be used in the next patches and will be turned on at the very end. Signed-off-by: Maxim Patlasov Signed-off-by: Pavel Emelyanov --- fs/fuse/fuse_i.h |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index

[PATCH 06/14] fuse: Trust kernel i_size only

2012-11-16 Thread Maxim Patlasov
short-read helper -- when a short read occurs the 'hole' is filled with zeroes. fuse_file_fallocate() is also fixed because now we should keep i_size up to date, so it must be updated if FUSE_FALLOCATE request succeeded. Original patch by: Pavel Emelyanov Signed-off-by: Maxim Patlasov ---

[PATCH 07/14] fuse: Update i_mtime on buffered writes

2012-11-16 Thread Maxim Patlasov
ents all bits related to flushing and clearing the flag. Signed-off-by: Maxim Patlasov --- fs/fuse/dir.c| 42 + fs/fuse/file.c | 31 ++--- fs/fuse/fuse_i.h | 13 - fs/fuse/inode.c | 79 +

[PATCH 08/14] fuse: Flush files on wb close

2012-11-16 Thread Maxim Patlasov
immediately and thus the -wait part of the mentioned call will be no-op. Do real wait on per-inode writepages list. Signed-off-by: Maxim Patlasov Signed-off-by: Pavel Emelyanov --- fs/fuse/file.c | 26 +- 1 files changed, 25 insertions(+), 1 deletions(-) diff --git a/fs

[PATCH 09/14] fuse: Implement writepages and write_begin/write_end callbacks

2012-11-16 Thread Maxim Patlasov
The .writepages one is required to make each writeback request carry more than one page on it. Original patch by: Pavel Emelyanov Signed-off-by: Maxim Patlasov --- fs/fuse/file.c | 251 1 files changed, 250 insertions(+), 1 deletions

[PATCH 10/14] fuse: fuse_writepage_locked() should wait on writeback

2012-11-16 Thread Maxim Patlasov
er. Signed-off-by: Maxim Patlasov --- fs/fuse/file.c | 18 +++--- 1 files changed, 15 insertions(+), 3 deletions(-) diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 3274708..4e4f6fd 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -1370,7 +1370,8 @@ static struct fuse_fil

[PATCH 11/14] fuse: fuse_flush() should wait on writeback

2012-11-16 Thread Maxim Patlasov
userspace yet if we won't ensure it explicitly. Signed-off-by: Maxim Patlasov --- fs/fuse/file.c |9 + 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 4e4f6fd..b73fe2a 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -17,6

[PATCH 12/14] fuse: Fix O_DIRECT operations vs cached writeback misorder

2012-11-16 Thread Maxim Patlasov
ion. Fix this by making the fuse direct IO callback explicitly wait on the in-flight writeback to finish. Original patch by: Pavel Emelyanov Signed-off-by: Maxim Patlasov --- fs/fuse/file.c | 40 1 files changed, 40 insertions(+), 0 deletions(-) d

  1   2   3   >