why are WB_SYNC_NONE COMMITs being done with FLUSH_SYNC set ?
Subsystems (12)
I'm looking at backporting some upstream changes to earlier kernels, and ran across something I don't quite understand...
In nfs_commit_unstable_pages, we set the flags to FLUSH_SYNC. We then zero out the flags if wbc->nonblocking or wbc->for_background is set.
Shouldn't we also clear it out if wbc->sync_mode == WB_SYNC_NONE ? WB_SYNC_NONE means "don't wait on anything", so shouldn't that include not waiting on the COMMIT to complete?
For discussion purposes, here's a patch that shows what I'm talking about (completely untested):
fs/nfs/write.c +2 -1
@@ -1440,7 +1440,8 @@ static int nfs_commit_unstable_pages(struct inode *inode, struct writeback_contr nfsi->ncommit <= (nfsi->npages >> 1)) goto out_mark_dirty; -if (wbc->nonblocking || wbc->for_background) +if (wbc->nonblocking || wbc->for_background || + wbc->sync_mode ==WB_SYNC_NONE ) flags =0 ; ret =nfs_commit_inode (inode, flags);if (ret >=0 ) {
Signature · 1 line
Jeff Layton <[email protected]>
Quoted 9 lines · Jeff Layton
I'm looking at backporting some upstream changes to earlier kernels, and ran across something I don't quite understand...
In
nfs_commit_unstable_pages, we set the flags toFLUSH_SYNC. We then zero out the flags ifwbc->nonblockingorwbc->for_backgroundis set.Shouldn't we also clear it out if
wbc->sync_mode==WB_SYNC_NONE?WB_SYNC_NONEmeans "don't wait on anything", so shouldn't that include not waiting on the COMMIT to complete?
I've been trying to figure out what the nonblocking flag is supposed to mean for a while now.
It basically disappeared in commit 0d99519efef15fd0cf84a849492c7b1deee1e4b7
"writeback: remove unused nonblocking and congestion checks"
from Wu. What's left these days is a couple of places in local copies of write_cache_pages (afs, cifs), and a couple of checks in random writepages instances (afs, block_write_full_page, ceph, nfs, reiserfs, xfs) and the use in nfs_write_inode. It's only actually set for memory migration and pageout, that is VM writeback.
To me it really doesn't make much sense, but maybe someone has a better idea what it is for.
fs/nfs/write.c static int nfs_commit_unstable_pages(struct inode *inode, struct writeback_contr · line 1444
Quoted 2 lines
fs/nfs/write.c +2
-0+if (wbc->nonblocking || wbc->for_background || + wbc->sync_mode ==WB_SYNC_NONE )
You could remove the nonblocking and for_background checks as these impliy WB_SYNC_NONE.
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 24 lines · Christoph Hellwig
Quoted 9 lines · Jeff Layton
I'm looking at backporting some upstream changes to earlier kernels, and ran across something I don't quite understand...
In
nfs_commit_unstable_pages, we set the flags toFLUSH_SYNC. We then zero out the flags ifwbc->nonblockingorwbc->for_backgroundis set.Shouldn't we also clear it out if
wbc->sync_mode==WB_SYNC_NONE?WB_SYNC_NONEmeans "don't wait on anything", so shouldn't that include not waiting on the COMMIT to complete?I've been trying to figure out what the nonblocking flag is supposed to mean for a while now.
It basically disappeared in commit
0d99519efef15fd0cf84a849492c7b1deee1e4b7"writeback: remove unused nonblocking and congestion checks"
from Wu. What's left these days is a couple of places in local copies of
write_cache_pages(afs, cifs), and a couple of checks in random writepages instances (afs,block_write_full_page, ceph, nfs, reiserfs, xfs) and the use innfs_write_inode. It's only actually set for memory migration and pageout, that is VM writeback.
Quoted 8 lines
To me it really doesn't make much sense, but maybe someone has a better idea what it is for.
fs/nfs/write.c static int nfs_commit_unstable_pages(struct inode *inode, struct writeback_contr · line 1444
Quoted 2 lines
fs/nfs/write.c +2
-0+if (wbc->nonblocking || wbc->for_background || + wbc->sync_mode ==WB_SYNC_NONE )You could remove the nonblocking and
for_backgroundchecks as these impliyWB_SYNC_NONE.
To me that sounds fine. I've also been trying to wrap my head around the differences between 'nonblocking', 'for_background', 'for_reclaim' and 'for_kupdate' and how the filesystem is supposed to treat them.
Aside from the above, I've used 'for_reclaim', 'for_kupdate' and 'for_background' in order to adjust the RPC request's queuing priority (high in the case of 'for_reclaim' and low for the other two).
Cheers
Trond
Quoted 34 lines · On Thu, 19 Aug 2010 10:58:25 -0400 Trond Myklebust…
Quoted 24 lines · Christoph Hellwig
Quoted 9 lines · Jeff Layton
I'm looking at backporting some upstream changes to earlier kernels, and ran across something I don't quite understand...
In
nfs_commit_unstable_pages, we set the flags toFLUSH_SYNC. We then zero out the flags ifwbc->nonblockingorwbc->for_backgroundis set.Shouldn't we also clear it out if
wbc->sync_mode==WB_SYNC_NONE?WB_SYNC_NONEmeans "don't wait on anything", so shouldn't that include not waiting on the COMMIT to complete?I've been trying to figure out what the nonblocking flag is supposed to mean for a while now.
It basically disappeared in commit
0d99519efef15fd0cf84a849492c7b1deee1e4b7"writeback: remove unused nonblocking and congestion checks"
from Wu. What's left these days is a couple of places in local copies of
write_cache_pages(afs, cifs), and a couple of checks in random writepages instances (afs,block_write_full_page, ceph, nfs, reiserfs, xfs) and the use innfs_write_inode. It's only actually set for memory migration and pageout, that is VM writeback.Quoted 8 lines
To me it really doesn't make much sense, but maybe someone has a better idea what it is for.
fs/nfs/write.c static int nfs_commit_unstable_pages(struct inode *inode, struct writeback_contr · line 1444
Quoted 2 lines
fs/nfs/write.c +2
-0+if (wbc->nonblocking || wbc->for_background || + wbc->sync_mode ==WB_SYNC_NONE )You could remove the nonblocking and
for_backgroundchecks as these impliyWB_SYNC_NONE.
Quoted 8 lines
To me that sounds fine. I've also been trying to wrap my head around the differences between 'nonblocking', '
for_background', 'for_reclaim' and 'for_kupdate' and how the filesystem is supposed to treat them.Aside from the above, I've used '
for_reclaim', 'for_kupdate' and 'for_background' in order to adjust the RPC request's queuing priority (high in the case of 'for_reclaim' and low for the other two).
Ok, I don't really have a great way to test the above change though aside from sticking it into the backport I'm working on for RHEL5 (2.6.18).
I suspect that the existing flag checks probably cover a lot of the WB_SYNC_NONE cases already. Changing it to a check for WB_SYNC_NONE would help me as RHEL5 doesn't have the for_background flag...
Cheers,
Signature · 7 lines
Jeff Layton <[email protected]> -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 3 lines · Trond Myklebust
To me that sounds fine. I've also been trying to wrap my head around the differences between 'nonblocking', '
for_background', 'for_reclaim' and 'for_kupdate' and how the filesystem is supposed to treat them.
Yeah, it's not clear to me either. for_background is in fact only used in nfs, for the priority and the nfs_commit_inode flags, for_kupdate is only used in nfs, and in a really weird spot in btrfs, and for_reclaim is used in nfs, and two places in nilfs2 and in shmemfs.
Quoted 3 lines
Aside from the above, I've used '
for_reclaim', 'for_kupdate' and 'for_background' in order to adjust the RPC request's queuing priority (high in the case of 'for_reclaim' and low for the other two).
Right now writepage calls to the filesystem can come from various places:
- the flusher threads
- VM reclaim (kswapd, memcg, direct reclaim)
- memory migration
- filemap_fdatawrite & other calls directly from FS code, also including fsync
We have WB_SYNC_ALL set for the second, data integrity pass when doing a sync from the flusher threads, and when doing data integrity writes from fs context (most fsync but also a few others). All these obviously are high priority. It's not too easy to set priorities for the others in my opinion.
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 34 lines · On Thu, 19 Aug 2010 10:58:25 -0400 Trond Myklebust…
Quoted 24 lines · Christoph Hellwig
Quoted 9 lines · Jeff Layton
I'm looking at backporting some upstream changes to earlier kernels, and ran across something I don't quite understand...
In
nfs_commit_unstable_pages, we set the flags toFLUSH_SYNC. We then zero out the flags ifwbc->nonblockingorwbc->for_backgroundis set.Shouldn't we also clear it out if
wbc->sync_mode==WB_SYNC_NONE?WB_SYNC_NONEmeans "don't wait on anything", so shouldn't that include not waiting on the COMMIT to complete?I've been trying to figure out what the nonblocking flag is supposed to mean for a while now.
It basically disappeared in commit
0d99519efef15fd0cf84a849492c7b1deee1e4b7"writeback: remove unused nonblocking and congestion checks"
from Wu. What's left these days is a couple of places in local copies of
write_cache_pages(afs, cifs), and a couple of checks in random writepages instances (afs,block_write_full_page, ceph, nfs, reiserfs, xfs) and the use innfs_write_inode. It's only actually set for memory migration and pageout, that is VM writeback.Quoted 8 lines
To me it really doesn't make much sense, but maybe someone has a better idea what it is for.
Review
Quoted 2 lines
(quoted diff) +2
-0+ if (wbc->nonblocking || wbc->for_background || + wbc->sync_mode == WB_SYNC_NONE)You could remove the nonblocking and
for_backgroundchecks as these impliyWB_SYNC_NONE.
Quoted 8 lines
To me that sounds fine. I've also been trying to wrap my head around the differences between 'nonblocking', '
for_background', 'for_reclaim' and 'for_kupdate' and how the filesystem is supposed to treat them.Aside from the above, I've used '
for_reclaim', 'for_kupdate' and 'for_background' in order to adjust the RPC request's queuing priority (high in the case of 'for_reclaim' and low for the other two).
Here's a lightly tested patch that turns the check for the two flags into a check for WB_SYNC_NONE. It seems to do the right thing, but I don't have a clear testcase for it. Does this look reasonable?
------------------[snip]------------------------
NFS: don't use FLUSH_SYNC on WB_SYNC_NONE COMMIT calls
WB_SYNC_NONE is supposed to mean "don't wait on anything". That should also include not waiting for COMMIT calls to complete.
WB_SYNC_NONE is also implied when wbc->nonblocking or wbc->for_background are set, so we can replace those checks in nfs_commit_unstable_pages with a check for WB_SYNC_NONE.
--- fs/nfs/write.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)
fs/nfs/write.c +5 -5
@@ -1436,12 +1436,12 @@ static int nfs_commit_unstable_pages(struct inode *inode, struct writeback_contr/* Don't commit yet if this is a non-blocking flush and there are * lots of outstanding writes for this mapping. */ -if (wbc->sync_mode ==WB_SYNC_NONE && - nfsi->ncommit <= (nfsi->npages >>1 )) - goto out_mark_dirty; - -if (wbc->nonblocking || wbc->for_background) +if (wbc->sync_mode ==WB_SYNC_NONE ) { +if (nfsi->ncommit <= (nfsi->npages >>1 )) + goto out_mark_dirty; flags =0 ; + } + ret =nfs_commit_inode (inode, flags);if (ret >=0 ) {if (wbc->sync_mode ==WB_SYNC_NONE ) {
Signature · 7 lines
1.5.5.6 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 41 lines · Jeff Layton
Quoted 38 lines · On Thu, 19 Aug 2010 10:58:25 -0400 Trond Myklebust…
Quoted 24 lines · Christoph Hellwig
Quoted 9 lines · Jeff Layton
I'm looking at backporting some upstream changes to earlier kernels, and ran across something I don't quite understand...
In
nfs_commit_unstable_pages, we set the flags toFLUSH_SYNC. We then zero out the flags ifwbc->nonblockingorwbc->for_backgroundis set.Shouldn't we also clear it out if
wbc->sync_mode==WB_SYNC_NONE?WB_SYNC_NONEmeans "don't wait on anything", so shouldn't that include not waiting on the COMMIT to complete?I've been trying to figure out what the nonblocking flag is supposed to mean for a while now.
It basically disappeared in commit
0d99519efef15fd0cf84a849492c7b1deee1e4b7"writeback: remove unused nonblocking and congestion checks"
from Wu. What's left these days is a couple of places in local copies of
write_cache_pages(afs, cifs), and a couple of checks in random writepages instances (afs,block_write_full_page, ceph, nfs, reiserfs, xfs) and the use innfs_write_inode. It's only actually set for memory migration and pageout, that is VM writeback.Quoted 8 lines
To me it really doesn't make much sense, but maybe someone has a better idea what it is for.
Review
Quoted 2 lines
(quoted diff) +2
-0+ if (wbc->nonblocking || wbc->for_background || + wbc->sync_mode == WB_SYNC_NONE)You could remove the nonblocking and
for_backgroundchecks as these impliyWB_SYNC_NONE.To me that sounds fine. I've also been trying to wrap my head around the differences between 'nonblocking', '
for_background', 'for_reclaim' and 'for_kupdate' and how the filesystem is supposed to treat them.
Quoted 8 lines
Quoted 4 lines
Aside from the above, I've used '
for_reclaim', 'for_kupdate' and 'for_background' in order to adjust the RPC request's queuing priority (high in the case of 'for_reclaim' and low for the other two).Here's a lightly tested patch that turns the check for the two flags into a check for
WB_SYNC_NONE. It seems to do the right thing, but I don't have a clear testcase for it. Does this look reasonable?
Looks fine to me. I'll queue it up for the post-2.6.36 merge window...
Cheers
Trond
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 5 lines
Quoted 3 lines
Here's a lightly tested patch that turns the check for the two flags into a check for
WB_SYNC_NONE. It seems to do the right thing, but I don't have a clear testcase for it. Does this look reasonable?Looks fine to me. I'll queue it up for the post-2.6.36 merge window...
Trond, I just created a patch that removes the wbc->nonblocking definition and all its references except NFS. So there will be merge dependencies. What should we do? To push both patches to Andrew's -mm tree?
Thanks,
Fengguang
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Trond Myklebust
Acked-byQuoted 6 lines · Wu Fengguang
Quoted 5 lines
Quoted 3 lines
Here's a lightly tested patch that turns the check for the two flags into a check for
WB_SYNC_NONE. It seems to do the right thing, but I don't have a clear testcase for it. Does this look reasonable?Looks fine to me. I'll queue it up for the post-2.6.36 merge window...
Quoted 7 lines
Trond, I just created a patch that removes the
wbc->nonblockingdefinition and all its references except NFS. So there will be merge dependencies. What should we do? To push both patches to Andrew's -mm tree?Thanks,
Fengguang
Do you want to include it as part of your series? Just remember to add an
Cheers
Trond
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 12 lines · Trond Myklebust
Quoted 11 lines · Wu Fengguang
Quoted 5 lines
Quoted 3 lines
Here's a lightly tested patch that turns the check for the two flags into a check for
WB_SYNC_NONE. It seems to do the right thing, but I don't have a clear testcase for it. Does this look reasonable?Looks fine to me. I'll queue it up for the post-2.6.36 merge window...
Trond, I just created a patch that removes the
wbc->nonblockingdefinition and all its references except NFS. So there will be merge dependencies. What should we do? To push both patches to Andrew's -mm tree?
Quoted 7 lines
Quoted 2 lines
Thanks,
FengguangDo you want to include it as part of your series? Just remember to add an
Acked-by Trond Myklebust <[email protected]>
Thanks. Please keep the NFS patches in your tree. I've send a patch to Andrew Morton which removes the other references but keeps the definitions. So that there won't be compile errors when the patches are pushed at different time.
Thanks,
Fengguang
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Wu Fengguang
Reviewed-byQuoted 3 lines
Here's a lightly tested patch that turns the check for the two flags into a check for
WB_SYNC_NONE. It seems to do the right thing, but I don't have a clear testcase for it. Does this look reasonable?
Yes, I don't see any problems.
Quoted 25 lines
------------------[snip]------------------------
NFS: don't use
FLUSH_SYNConWB_SYNC_NONECOMMIT calls
WB_SYNC_NONEis supposed to mean "don't wait on anything". That should also include not waiting for COMMIT calls to complete.
WB_SYNC_NONEis also implied whenwbc->nonblockingorwbc->for_backgroundare set, so we can replace those checks innfs_commit_unstable_pageswith a check forWB_SYNC_NONE.Signed-off-by Jeff Layton <[email protected]>--- fs/nfs/write.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)fs/nfs/write.c +0
-1@@ -1436,12 +1436,12 @@ static int nfs_commit_unstable_pages(struct inode *inode, struct writeback_contr/* Don't commit yet if this is a non-blocking flush and there are * lots of outstanding writes for this mapping. */ - if (wbc->sync_mode == WB_SYNC_NONE &&
fs/nfs/write.c static int nfs_commit_unstable_pages(struct inode *inode, struct writeback_contr · line 1444
Quoted 10 lines
fs/nfs/write.c +5
-4- nfsi->ncommit <= (nfsi->npages >> 1)) - goto out_mark_dirty; - -if (wbc->nonblocking || wbc->for_background) +if (wbc->sync_mode ==WB_SYNC_NONE ) { +if (nfsi->ncommit <= (nfsi->npages >>1 )) + goto out_mark_dirty; flags =0 ; + } +
nitpick: I'd slightly prefer an one-line change
- if (wbc->nonblocking || wbc->for_background)
+ if (wbc->sync_mode == WB_SYNC_NONE)
flags = 0;
That way the patch will look more obvious and "git blame" friendly, and the original "Don't commit.." comment will best match its code.
Thanks,
Fengguang
Quoted 48 lines · On Fri, 20 Aug 2010 08:33:08 +0800 Wu Fengguang <[email protected]> wrote:
Quoted 3 lines
Here's a lightly tested patch that turns the check for the two flags into a check for
WB_SYNC_NONE. It seems to do the right thing, but I don't have a clear testcase for it. Does this look reasonable?Yes, I don't see any problems.
Quoted 25 lines
------------------[snip]------------------------
NFS: don't use
FLUSH_SYNConWB_SYNC_NONECOMMIT calls
WB_SYNC_NONEis supposed to mean "don't wait on anything". That should also include not waiting for COMMIT calls to complete.
WB_SYNC_NONEis also implied whenwbc->nonblockingorwbc->for_backgroundare set, so we can replace those checks innfs_commit_unstable_pageswith a check forWB_SYNC_NONE.Signed-off-by Jeff Layton <[email protected]>--- fs/nfs/write.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)fs/nfs/write.c +0
-1@@ -1436,12 +1436,12 @@ static int nfs_commit_unstable_pages(struct inode *inode, struct writeback_contr/* Don't commit yet if this is a non-blocking flush and there are * lots of outstanding writes for this mapping. */ - if (wbc->sync_mode == WB_SYNC_NONE &&fs/nfs/write.c static int nfs_commit_unstable_pages(struct inode *inode, struct writeback_contr · line 1444
Quoted 10 lines
fs/nfs/write.c +5
-4- nfsi->ncommit <= (nfsi->npages >> 1)) - goto out_mark_dirty; - -if (wbc->nonblocking || wbc->for_background) +if (wbc->sync_mode ==WB_SYNC_NONE ) { +if (nfsi->ncommit <= (nfsi->npages >>1 )) + goto out_mark_dirty; flags =0 ; + } +nitpick: I'd slightly prefer an one-line change
fs/nfs/write.c +1
-1-if (wbc->nonblocking || wbc->for_background) +if (wbc->sync_mode ==WB_SYNC_NONE ) flags =0 ;
Quoted 7 lines
That way the patch will look more obvious and "git blame" friendly, and the original "Don't commit.." comment will best match its code.
Reviewed-by Wu Fengguang <[email protected]>Thanks,
Fengguang
Either way. I figured it would be slightly more efficient to just check WB_SYNC_NONE once in that function. I suppose we could just fix up the comments instead. Let me know if I should respin the patch with updated comments...
Thanks for the review...
Signature · 1 line
Jeff Layton <[email protected]>
Quoted 56 lines · Jeff Layton
Quoted 53 lines · On Fri, 20 Aug 2010 08:33:08 +0800 Wu Fengguang <[email protected]> wrote:
Quoted 3 lines
Here's a lightly tested patch that turns the check for the two flags into a check for
WB_SYNC_NONE. It seems to do the right thing, but I don't have a clear testcase for it. Does this look reasonable?Yes, I don't see any problems.
Quoted 25 lines
------------------[snip]------------------------
NFS: don't use
FLUSH_SYNConWB_SYNC_NONECOMMIT calls
WB_SYNC_NONEis supposed to mean "don't wait on anything". That should also include not waiting for COMMIT calls to complete.
WB_SYNC_NONEis also implied whenwbc->nonblockingorwbc->for_backgroundare set, so we can replace those checks innfs_commit_unstable_pageswith a check forWB_SYNC_NONE.Signed-off-by Jeff Layton <[email protected]>--- fs/nfs/write.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)fs/nfs/write.c +0
-1@@ -1436,12 +1436,12 @@ static int nfs_commit_unstable_pages(struct inode *inode, struct writeback_contr/* Don't commit yet if this is a non-blocking flush and there are * lots of outstanding writes for this mapping. */ - if (wbc->sync_mode == WB_SYNC_NONE &&fs/nfs/write.c static int nfs_commit_unstable_pages(struct inode *inode, struct writeback_contr · line 1444
Quoted 10 lines
fs/nfs/write.c +5
-4- nfsi->ncommit <= (nfsi->npages >> 1)) - goto out_mark_dirty; - -if (wbc->nonblocking || wbc->for_background) +if (wbc->sync_mode ==WB_SYNC_NONE ) { +if (nfsi->ncommit <= (nfsi->npages >>1 )) + goto out_mark_dirty; flags =0 ; + } +nitpick: I'd slightly prefer an one-line change
fs/nfs/write.c +1
-1-if (wbc->nonblocking || wbc->for_background) +if (wbc->sync_mode ==WB_SYNC_NONE ) flags =0 ;That way the patch will look more obvious and "git blame" friendly, and the original "Don't commit.." comment will best match its code.
Reviewed-by Wu Fengguang <[email protected]>
Quoted 7 lines
Quoted 2 lines
Thanks,
FengguangEither way. I figured it would be slightly more efficient to just check
WB_SYNC_NONEonce in that function. I suppose we could just fix up the comments instead. Let me know if I should respin the patch with updated comments...
OK, please do the comments.
Quoted 1 line
Thanks for the review...
You are welcome.
Thanks,
Fengguang
Quoted 14 lines · Christoph Hellwig
Quoted 9 lines · Jeff Layton
I'm looking at backporting some upstream changes to earlier kernels, and ran across something I don't quite understand...
In
nfs_commit_unstable_pages, we set the flags toFLUSH_SYNC. We then zero out the flags ifwbc->nonblockingorwbc->for_backgroundis set.Shouldn't we also clear it out if
wbc->sync_mode==WB_SYNC_NONE?WB_SYNC_NONEmeans "don't wait on anything", so shouldn't that include not waiting on the COMMIT to complete?I've been trying to figure out what the nonblocking flag is supposed to mean for a while now.
Quoted 8 lines
It basically disappeared in commit
0d99519efef15fd0cf84a849492c7b1deee1e4b7"writeback: remove unused nonblocking and congestion checks"
from Wu. What's left these days is a couple of places in local copies of
write_cache_pages(afs, cifs), and a couple of checks in random writepages instances (afs,block_write_full_page, ceph, nfs, reiserfs, xfs) and the use innfs_write_inode.
In principle all nonblocking checks in ->writepages should be removed.
(My original patch does have chunks for afs/cifs that somehow get
dropped in the process, and missed ceph because it's not upstream when I started patch..)
Quoted 5 lines
It's only actually set for memory
migration and pageout, that is VM writeback.To me it really doesn't make much sense, but maybe someone has a better idea what it is for.
Since migration and pageout still set nonblocking for ->writepage, we may keep them in the near future, until VM does not start IO on itself.
Quoted 5 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ if (wbc->nonblocking || wbc->for_background || + wbc->sync_mode == WB_SYNC_NONE)You could remove the nonblocking and
for_backgroundchecks as these impliyWB_SYNC_NONE.
Agreed.
Thanks,
Fengguang
---
writeback: remove useless nonblocking checks in ->writepages
This removes more deadcode that was somehow missed by commit 0d99519efef (writeback: remove unused nonblocking and congestion checks).
The nonblocking checks in ->writepages are no longer used because the flusher now prefer to block on get_request_wait() than to skip inodes on IO congestion. The latter will lead to more seeky IO.
--- fs/afs/write.c | 16 +--------------- fs/cifs/file.c | 10 ---------- 2 files changed, 1 insertion(+), 25 deletions(-)
fs/afs/write.c +1 -15
@@ -455,8 +455,6 @@ int afs_writepage(struct page *page, str } wbc->nr_to_write -= ret; -if (wbc->nonblocking &&bdi_write_congested (bdi)) - wbc->encountered_congestion =1 ;_leave (" = 0" );return 0 ;
@@ -529,11 +527,6 @@ static int afs_writepages_region(struct wbc->nr_to_write -= ret; -if (wbc->nonblocking &&bdi_write_congested (bdi)) { - wbc->encountered_congestion =1 ; -break ; - } -cond_resched (); }while (index < end && wbc->nr_to_write >0 );
@@ -554,18 +547,11 @@ int afs_writepages(struct address_space_enter ("" ); -if (wbc->nonblocking &&bdi_write_congested (bdi)) { - wbc->encountered_congestion =1 ; -_leave (" = 0 [congest]" ); -return 0 ; - } -if (wbc->range_cyclic) { start = mapping->writeback_index; end =-1 ; ret =afs_writepages_region (mapping, wbc, start, end, &next); -if (start >0 && wbc->nr_to_write >0 && ret ==0 && - !(wbc->nonblocking && wbc->encountered_congestion)) +if (start >0 && wbc->nr_to_write >0 && ret ==0 ) ret =afs_writepages_region (mapping, wbc,0 , start, &next); mapping->writeback_index = next;
fs/cifs/file.c +0 -10
@@ -1379,16 +1379,6 @@ static int cifs_writepages(struct addresreturn generic_writepages (mapping, wbc); -/* -* BB: Is this meaningful for a non-block-device file system? -* If it is, we should test it again after we do I/O -*/ -if (wbc->nonblocking &&bdi_write_congested (bdi)) { - wbc->encountered_congestion =1 ; -kfree (iov); -return 0 ; - } - xid =GetXid ();pagevec_init (&pvec,0 );
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
[add CC to afs/cifs/ceph maintainers]
Quoted 45 lines · Wu Fengguang
Quoted 14 lines · Christoph Hellwig
Quoted 9 lines · Jeff Layton
I'm looking at backporting some upstream changes to earlier kernels, and ran across something I don't quite understand...
In
nfs_commit_unstable_pages, we set the flags toFLUSH_SYNC. We then zero out the flags ifwbc->nonblockingorwbc->for_backgroundis set.Shouldn't we also clear it out if
wbc->sync_mode==WB_SYNC_NONE?WB_SYNC_NONEmeans "don't wait on anything", so shouldn't that include not waiting on the COMMIT to complete?I've been trying to figure out what the nonblocking flag is supposed to mean for a while now.
Quoted 8 lines
It basically disappeared in commit
0d99519efef15fd0cf84a849492c7b1deee1e4b7"writeback: remove unused nonblocking and congestion checks"
from Wu. What's left these days is a couple of places in local copies of
write_cache_pages(afs, cifs), and a couple of checks in random writepages instances (afs,block_write_full_page, ceph, nfs, reiserfs, xfs) and the use innfs_write_inode.In principle all nonblocking checks in ->writepages should be removed.
(My original patch does have chunks for afs/cifs that somehow get
dropped in the process, and missed ceph because it's not upstream when I started patch..)Quoted 5 lines
It's only actually set for memory
migration and pageout, that is VM writeback.To me it really doesn't make much sense, but maybe someone has a better idea what it is for.
Since migration and pageout still set nonblocking for ->writepage, we may keep them in the near future, until VM does not start IO on itself.
Quoted 5 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ if (wbc->nonblocking || wbc->for_background || + wbc->sync_mode == WB_SYNC_NONE)You could remove the nonblocking and
for_backgroundchecks as these impliyWB_SYNC_NONE.
Quoted 4 lines
Agreed.
Thanks,
Fengguang
Subject: writeback: remove useless nonblocking checks in ->writepages
From: Wu Fengguang <[email protected]>
Date: Fri Aug 20 07:04:54 CST 2010
This removes more deadcode that was somehow missed by commit 0d99519efef (writeback: remove unused nonblocking and congestion checks).
The nonblocking checks in ->writepages are no longer used because the flusher now prefer to block on get_request_wait() than to skip inodes on IO congestion. The latter will lead to more seeky IO.
--- fs/afs/write.c | 16 +--------------- fs/cifs/file.c | 10 ---------- 2 files changed, 1 insertion(+), 25 deletions(-)
fs/afs/write.c +1 -15
@@ -455,8 +455,6 @@ int afs_writepage(struct page *page, str } wbc->nr_to_write -= ret; -if (wbc->nonblocking &&bdi_write_congested (bdi)) - wbc->encountered_congestion =1 ;_leave (" = 0" );return 0 ;
@@ -529,11 +527,6 @@ static int afs_writepages_region(struct wbc->nr_to_write -= ret; -if (wbc->nonblocking &&bdi_write_congested (bdi)) { - wbc->encountered_congestion =1 ; -break ; - } -cond_resched (); }while (index < end && wbc->nr_to_write >0 );
@@ -554,18 +547,11 @@ int afs_writepages(struct address_space_enter ("" ); -if (wbc->nonblocking &&bdi_write_congested (bdi)) { - wbc->encountered_congestion =1 ; -_leave (" = 0 [congest]" ); -return 0 ; - } -if (wbc->range_cyclic) { start = mapping->writeback_index; end =-1 ; ret =afs_writepages_region (mapping, wbc, start, end, &next); -if (start >0 && wbc->nr_to_write >0 && ret ==0 && - !(wbc->nonblocking && wbc->encountered_congestion)) +if (start >0 && wbc->nr_to_write >0 && ret ==0 ) ret =afs_writepages_region (mapping, wbc,0 , start, &next); mapping->writeback_index = next;
fs/cifs/file.c +0 -10
@@ -1379,16 +1379,6 @@ static int cifs_writepages(struct addresreturn generic_writepages (mapping, wbc); -/* -* BB: Is this meaningful for a non-block-device file system? -* If it is, we should test it again after we do I/O -*/ -if (wbc->nonblocking &&bdi_write_congested (bdi)) { - wbc->encountered_congestion =1 ; -kfree (iov); -return 0 ; - } - xid =GetXid ();pagevec_init (&pvec,0 );
Quoted 32 lines · Wu Fengguang
[add CC to afs/cifs/ceph maintainers]
Quoted 29 lines · Wu Fengguang
Quoted 14 lines · Christoph Hellwig
Quoted 9 lines · Jeff Layton
I'm looking at backporting some upstream changes to earlier kernels, and ran across something I don't quite understand...
In
nfs_commit_unstable_pages, we set the flags toFLUSH_SYNC. We then zero out the flags ifwbc->nonblockingorwbc->for_backgroundis set.Shouldn't we also clear it out if
wbc->sync_mode==WB_SYNC_NONE?WB_SYNC_NONEmeans "don't wait on anything", so shouldn't that include not waiting on the COMMIT to complete?I've been trying to figure out what the nonblocking flag is supposed to mean for a while now.
Quoted 8 lines
It basically disappeared in commit
0d99519efef15fd0cf84a849492c7b1deee1e4b7"writeback: remove unused nonblocking and congestion checks"
from Wu. What's left these days is a couple of places in local copies of
write_cache_pages(afs, cifs), and a couple of checks in random writepages instances (afs,block_write_full_page, ceph, nfs, reiserfs, xfs) and the use innfs_write_inode.In principle all nonblocking checks in ->writepages should be removed.
(My original patch does have chunks for afs/cifs that somehow get
dropped in the process, and missed ceph because it's not upstream when I started patch..)
I'll queue up a fix for Ceph's ->writepages in my tree.
Thanks!
sage
Quoted 21 lines
Quoted 20 lines
Quoted 6 lines
It's only actually set for memory
migration and pageout, that is VM writeback.To me it really doesn't make much sense, but maybe someone has a better idea what it is for.
Since migration and pageout still set nonblocking for ->writepage, we may keep them in the near future, until VM does not start IO on itself.
Quoted 5 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ if (wbc->nonblocking || wbc->for_background || + wbc->sync_mode == WB_SYNC_NONE)You could remove the nonblocking and
for_backgroundchecks as these impliyWB_SYNC_NONE.Agreed.
Thanks,
Fengguang
Quoted 2 lines · Wu Fengguang
Since migration and pageout still set nonblocking for ->writepage, we may keep them in the near future, until VM does not start IO on itself.
Why does pageout() and memory migration need to be even more non-blocking than the already non-blockig WB_SYNC_NONE writeout?
Quoted 7 lines · On Fri, 20 Aug 2010 05:19:04 -0400 Christoph Hellwig…
Quoted 2 lines · Wu Fengguang
Since migration and pageout still set nonblocking for ->writepage, we may keep them in the near future, until VM does not start IO on itself.
Why does
pageout()and memory migration need to be even more non-blocking than the already non-blockigWB_SYNC_NONEwriteout?
Just an idle thought on this...
I think a lot of the confusion here comes from the fact that we have sync_mode and a bunch of flags, and it's not at all clear how filesystems are supposed to treat the union of them. There are also possible unions of flags/sync_modes that never happen in practice. It's not always obvious though and as filesystem implementors we have to consider the possibility that they might occur (consider WB_SYNC_ALL + for_background).
Perhaps a lot of this confusion could be lifted by getting rid of the extra flags and adding new sync_mode's. Maybe something like:
WB_SYNC_ALL /* wait on everything to complete */WB_SYNC_NONE /* don't wait on anything */WB_SYNC_FOR_RECLAIM /* sync for reclaim */WB_SYNC_FOR_KUPDATED /* sync by kupdate */
...etc...
That does mean that all of the filesystem specific code may need to be touched when new modes are added and removed. I think it would be clearer though about what you're supposed to do in ->writepages.
Signature · 5 lines
Jeff Layton <[email protected]> -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 30 lines · Jeff Layton
Quoted 7 lines · On Fri, 20 Aug 2010 05:19:04 -0400 Christoph Hellwig <[email protected]> wrote:
Quoted 2 lines · Wu Fengguang
Since migration and pageout still set nonblocking for ->writepage, we may keep them in the near future, until VM does not start IO on itself.
Why does
pageout()and memory migration need to be even more non-blocking than the already non-blockigWB_SYNC_NONEwriteout?Just an idle thought on this...
I think a lot of the confusion here comes from the fact that we have
sync_modeand a bunch of flags, and it's not at all clear how filesystems are supposed to treat the union of them. There are also possible unions of flags/sync_modes that never happen in practice. It's not always obvious though and as filesystem implementors we have to consider the possibility that they might occur (considerWB_SYNC_ALL+for_background).Perhaps a lot of this confusion could be lifted by getting rid of the extra flags and adding new sync_mode's. Maybe something like:
WB_SYNC_ALL/* wait on everything to complete */WB_SYNC_NONE/* don't wait on anything */WB_SYNC_FOR_RECLAIM/* sync for reclaim */WB_SYNC_FOR_KUPDATED/* sync by kupdate */
...etc...
Quoted 3 lines
That does mean that all of the filesystem specific code may need to be touched when new modes are added and removed. I think it would be clearer though about what you're supposed to do in ->writepages.
No, we are moving towards the other direction :)
I just removed the definition of wbc->nonblocking and wbc->encountered_congestion and all of the references.
Sorry for the confusion!
Thanks,
Fengguang
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 6 lines · Christoph Hellwig
Quoted 2 lines · Wu Fengguang
Since migration and pageout still set nonblocking for ->writepage, we may keep them in the near future, until VM does not start IO on itself.
Why does
pageout()and memory migration need to be even more non-blocking than the already non-blockigWB_SYNC_NONEwriteout?
Good question! So the other nonblocking checks in ->writepage are also redundant code, let's rip them all!
Thanks,
Fengguang
---
include/linux/writeback.h +0 -2
@@ -45,8 +45,6 @@ struct writeback_control {loff_t range_start;loff_t range_end; - unsigned nonblocking:1; /* Don't get stuck on request queues */ - unsigned encountered_congestion:1; /* An output: a queue is full */ unsigned for_kupdate:1; /* A kupdate writeback */ unsigned for_background:1; /* A background writeback */ unsigned for_reclaim:1; /* Invoked from the page allocator */
fs/buffer.c +1 -1
@@ -1706,7 +1706,7 @@ static int __block_write_full_page(struct inode *inode, struct page *page,* and kswapd activity, but those code paths have their own * higher-level throttling. */ -if (wbc->sync_mode !=WB_SYNC_NONE || !wbc->nonblocking) { +if (wbc->sync_mode !=WB_SYNC_NONE ) {lock_buffer (bh); }else if (!trylock_buffer (bh)) {redirty_page_for_writepage (wbc, page);
fs/gfs2/meta_io.c +1 -1
@@ -55,7 +55,7 @@ static int gfs2_aspace_writepage(struct page *page, struct writeback_control *wb* activity, but those code paths have their own higher-level * throttling. */ -if (wbc->sync_mode !=WB_SYNC_NONE || !wbc->nonblocking) { +if (wbc->sync_mode !=WB_SYNC_NONE ) {lock_buffer (bh); }else if (!trylock_buffer (bh)) {redirty_page_for_writepage (wbc, page);
fs/reiserfs/inode.c +1 -1
@@ -2438,7 +2438,7 @@ static int reiserfs_write_full_page(struct page *page,/* from this point on, we know the buffer is mapped to a * real block and not a direct item */ -if (wbc->sync_mode !=WB_SYNC_NONE || !wbc->nonblocking) { +if (wbc->sync_mode !=WB_SYNC_NONE ) {lock_buffer (bh); }else {if (!trylock_buffer (bh)) {
fs/xfs/linux-2.6/xfs_aops.c +1 -2
@@ -1139,8 +1139,7 @@ xfs_vm_writepage( type =IO_DELAY ; flags =BMAPI_ALLOCATE ; -if (wbc->sync_mode ==WB_SYNC_NONE && - wbc->nonblocking) +if (wbc->sync_mode ==WB_SYNC_NONE ) flags |=BMAPI_TRYLOCK ; }
include/trace/events/writeback.h +0 -2
@@ -96,8 +96,6 @@ DECLARE_EVENT_CLASS(wbc_class, __field(long, nr_to_write) __field(long, pages_skipped) __field(int, sync_mode) - __field(int, nonblocking) - __field(int, encountered_congestion) __field(int, for_kupdate) __field(int, for_background)__field (int, for_reclaim)
mm/migrate.c +0 -1
@@ -431,7 +431,6 @@ static int writeout(struct address_space *mapping, struct page *page) .nr_to_write = 1, .range_start = 0, .range_end = LLONG_MAX, - .nonblocking = 1, .for_reclaim = 1 };int rc;
mm/vmscan.c +0 -1
@@ -376,7 +376,6 @@ static pageout_t pageout(struct page *page, struct address_space *mapping, .nr_to_write = SWAP_CLUSTER_MAX, .range_start = 0, .range_end = LLONG_MAX, - .nonblocking = 1, .for_reclaim = 1, };
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html