[PATCH] Don't pass offset == 0 && endbyte == 0 to do_sync_file_range()

From: OGAWA Hirofumi
Date: Sat Apr 01 2006 - 16:20:06 EST


If user is specifying offset == 0 and nbytes == 1, current code uses
wbc->start == 0 && wbc->end == 0 to flush the range.

However, wbc->start == 0 && wbc->end == 0 is special range, not 0th page.
[If wbc->sync_mode == WB_SYNC_NODE, it uses prev offset. Otherwise it
uses whole of file.]

It may confuse user, so, don't export that behavior to userland.

Signed-off-by: OGAWA Hirofumi <hirofumi@xxxxxxxxxxxxxxxxxx>
---

fs/sync.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff -puN fs/sync.c~sync_file_range-fix fs/sync.c
--- linux-2.6/fs/sync.c~sync_file_range-fix 2006-04-02 06:20:52.000000000 +0900
+++ linux-2.6-hirofumi/fs/sync.c 2006-04-02 06:20:52.000000000 +0900
@@ -101,8 +101,14 @@ asmlinkage long sys_sync_file_range(int

if (nbytes == 0)
endbyte = -1;
- else
- endbyte--; /* inclusive */
+ else {
+ /*
+ * wbc->start == 0 && wbc->end == 0 is a special range,
+ * so this avoids using it.
+ */
+ if (endbyte > 1)
+ endbyte--; /* inclusive */
+ }

ret = -EBADF;
file = fget_light(fd, &fput_needed);
_
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/