Skip to contentSkip to conversation

fuse: Consider the ->big_writes for allocing fuse_req when do writing

PATCH In review majianpeng 2 participants 2 messages Mar 27, 2013 – May 2, 2013 FUSE filesystem core

lore
Share & tools
lore

majianpeng

author
#0 lore raw

PATCH 1/1 fuse: Consider the ->big_writes for allocing fuse_req when do writing

If fc->big_writes == 0, for write-operation it only do 4k in func fuse_fill_write_pages.
So when alloc fuse_req,we should consider this restrict in order to
do additional operations.
The additional operations are memset-opeartion in func fuse_requenst_alloc and alloc more space if nr_pages is larger than FUSE_REQ_MIN_PAGES.

---
fs/fuse/file.c | 7 ++++++-

1 file changed, 6 insertions(+), 1 deletion(-)
fs/fuse/file.c +0 -0
index 34b80ba..c584a31 100644
@@ -912,8 +912,13 @@ static ssize_t fuse_perform_write(struct file *file,

do {
struct fuse_req *req;
ssize_t count;
- unsigned nr_pages = fuse_wr_pages(pos, iov_iter_count(ii));
+ unsigned nr_pages;

+ if (!fc->big_writes)
+ nr_pages = 1;
+ else
+ nr_pages = fuse_wr_pages(pos, iov_iter_count(ii)); +
req = fuse_get_req(fc, nr_pages);
if (IS_ERR(req)) {
err = PTR_ERR(req);

Signature · 1 line
1.8.2.rc2.4.g7799588
maintainer
#1 lore raw
Quoted 4 lines · majianpeng

If fc->big_writes == 0, for write-operation it only do 4k in func fuse_fill_write_pages.
So when alloc fuse_req,we should consider this restrict in order to
do additional operations.
The additional operations are memset-opeartion in func fuse_requenst_alloc and alloc more space if nr_pages is larger than FUSE_REQ_MIN_PAGES.

Your mailer is removing whitespace from the patch. Anyway, I applied
it by hand, thanks.

Miklos

Quoted 28 lines

---
fs/fuse/file.c | 7 ++++++-

1 file changed, 6 insertions(+), 1 deletion(-)
fs/fuse/file.c +6 -2
index 34b80ba..c584a31 100644
@@ -912,8 +912,13 @@ static ssize_t fuse_perform_write(struct file *file,
 do {
 struct fuse_req *req;
 ssize_t count;
- unsigned nr_pages = fuse_wr_pages(pos, iov_iter_count(ii));
+ unsigned nr_pages;
 
+ if (!fc->big_writes)
+ nr_pages = 1;
+ else
+ nr_pages = fuse_wr_pages(pos, iov_iter_count(ii));
+
 req = fuse_get_req(fc, nr_pages);
 if (IS_ERR(req)) {
 err = PTR_ERR(req);
--

1.8.2.rc2.4.g7799588