Re: [PATCH] splice: partial write handling fix
Jens Axboe <[EMAIL PROTECTED]> writes: > On Wed, Mar 14 2007, Dmitriy Monakhov wrote: >> currently if partial write has happened while ->commit_write() then page >> wasn't marked as accessed and rebalanced. > > The ->commit_write() return values aren't very well designed imho. Is > your fix correct getting the pipe_to_file() return value correct now? I think yes, after my patch this path look like follows: ret = mapping->a_ops->commit_write(file, page, offset, offset+this_len); if (ret) { if(ret == AOP_TRUNCATED_PAGE) { page_cache_release(page); goto find_page; } if (ret < 0) goto out; /* * Partial write has happened, so 'ret' already initialized by * number of bytes written, Where is nothing we have to do here. */ } else ret = this_len; /* * Return the number of bytes written and mark page as * accessed, we are now done! */ mark_page_accessed(page); balance_dirty_pages_ratelimited(mapping); out: page_cache_release(page); unlock_page(page); out_ret: return ret; } But off corse this patch does't fix issues spotted by Nick. > > -- > Jens Axboe > > - > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to [EMAIL PROTECTED] > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] splice: partial write handling fix
On Wed, Mar 14 2007, Dmitriy Monakhov wrote: > currently if partial write has happened while ->commit_write() then page > wasn't marked as accessed and rebalanced. The ->commit_write() return values aren't very well designed imho. Is your fix correct getting the pipe_to_file() return value correct now? -- Jens Axboe - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] splice: partial write handling fix
On Wed, Mar 14 2007, Dmitriy Monakhov wrote: currently if partial write has happened while -commit_write() then page wasn't marked as accessed and rebalanced. The -commit_write() return values aren't very well designed imho. Is your fix correct getting the pipe_to_file() return value correct now? -- Jens Axboe - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] splice: partial write handling fix
Jens Axboe [EMAIL PROTECTED] writes: On Wed, Mar 14 2007, Dmitriy Monakhov wrote: currently if partial write has happened while -commit_write() then page wasn't marked as accessed and rebalanced. The -commit_write() return values aren't very well designed imho. Is your fix correct getting the pipe_to_file() return value correct now? I think yes, after my patch this path look like follows: ret = mapping-a_ops-commit_write(file, page, offset, offset+this_len); if (ret) { if(ret == AOP_TRUNCATED_PAGE) { page_cache_release(page); goto find_page; } if (ret 0) goto out; /* * Partial write has happened, so 'ret' already initialized by * number of bytes written, Where is nothing we have to do here. */ } else ret = this_len; /* * Return the number of bytes written and mark page as * accessed, we are now done! */ mark_page_accessed(page); balance_dirty_pages_ratelimited(mapping); out: page_cache_release(page); unlock_page(page); out_ret: return ret; } But off corse this patch does't fix issues spotted by Nick. -- Jens Axboe - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] splice: partial write handling fix
currently if partial write has happened while ->commit_write() then page wasn't marked as accessed and rebalanced. Signed-off-by: Monakhov Dmitriy <[EMAIL PROTECTED]> diff --git a/fs/splice.c b/fs/splice.c index 2fca6eb..bb1bf62 100644 --- a/fs/splice.c +++ b/fs/splice.c @@ -682,18 +682,25 @@ find_page: } ret = mapping->a_ops->commit_write(file, page, offset, offset+this_len); - if (!ret) { + if (ret) { + if(ret == AOP_TRUNCATED_PAGE) { + page_cache_release(page); + goto find_page; + } + if (ret < 0) + goto out; /* -* Return the number of bytes written and mark page as -* accessed, we are now done! +* Partial write has happened, so 'ret' already initialized by +* number of bytes written, Where is nothing we have to do here. */ + } else ret = this_len; - mark_page_accessed(page); - balance_dirty_pages_ratelimited(mapping); - } else if (ret == AOP_TRUNCATED_PAGE) { - page_cache_release(page); - goto find_page; - } + /* +* Return the number of bytes written and mark page as +* accessed, we are now done! +*/ + mark_page_accessed(page); + balance_dirty_pages_ratelimited(mapping); out: page_cache_release(page); unlock_page(page); - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] splice: partial write handling fix
currently if partial write has happened while -commit_write() then page wasn't marked as accessed and rebalanced. Signed-off-by: Monakhov Dmitriy [EMAIL PROTECTED] diff --git a/fs/splice.c b/fs/splice.c index 2fca6eb..bb1bf62 100644 --- a/fs/splice.c +++ b/fs/splice.c @@ -682,18 +682,25 @@ find_page: } ret = mapping-a_ops-commit_write(file, page, offset, offset+this_len); - if (!ret) { + if (ret) { + if(ret == AOP_TRUNCATED_PAGE) { + page_cache_release(page); + goto find_page; + } + if (ret 0) + goto out; /* -* Return the number of bytes written and mark page as -* accessed, we are now done! +* Partial write has happened, so 'ret' already initialized by +* number of bytes written, Where is nothing we have to do here. */ + } else ret = this_len; - mark_page_accessed(page); - balance_dirty_pages_ratelimited(mapping); - } else if (ret == AOP_TRUNCATED_PAGE) { - page_cache_release(page); - goto find_page; - } + /* +* Return the number of bytes written and mark page as +* accessed, we are now done! +*/ + mark_page_accessed(page); + balance_dirty_pages_ratelimited(mapping); out: page_cache_release(page); unlock_page(page); - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/