aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/file.c24
-rw-r--r--fs/fs-writeback.c4
-rw-r--r--fs/mpage.c22
-rw-r--r--fs/sync.c2
4 files changed, 26 insertions, 26 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index e2b4ce1dad66..487ea8b3baaa 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -1079,9 +1079,9 @@ static int cifs_writepages(struct address_space *mapping,
1079 unsigned int bytes_written; 1079 unsigned int bytes_written;
1080 struct cifs_sb_info *cifs_sb; 1080 struct cifs_sb_info *cifs_sb;
1081 int done = 0; 1081 int done = 0;
1082 pgoff_t end = -1; 1082 pgoff_t end;
1083 pgoff_t index; 1083 pgoff_t index;
1084 int is_range = 0; 1084 int range_whole = 0;
1085 struct kvec iov[32]; 1085 struct kvec iov[32];
1086 int len; 1086 int len;
1087 int n_iov = 0; 1087 int n_iov = 0;
@@ -1122,16 +1122,14 @@ static int cifs_writepages(struct address_space *mapping,
1122 xid = GetXid(); 1122 xid = GetXid();
1123 1123
1124 pagevec_init(&pvec, 0); 1124 pagevec_init(&pvec, 0);
1125 if (wbc->sync_mode == WB_SYNC_NONE) 1125 if (wbc->range_cyclic) {
1126 index = mapping->writeback_index; /* Start from prev offset */ 1126 index = mapping->writeback_index; /* Start from prev offset */
1127 else { 1127 end = -1;
1128 index = 0; 1128 } else {
1129 scanned = 1; 1129 index = wbc->range_start >> PAGE_CACHE_SHIFT;
1130 } 1130 end = wbc->range_end >> PAGE_CACHE_SHIFT;
1131 if (wbc->start || wbc->end) { 1131 if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX)
1132 index = wbc->start >> PAGE_CACHE_SHIFT; 1132 range_whole = 1;
1133 end = wbc->end >> PAGE_CACHE_SHIFT;
1134 is_range = 1;
1135 scanned = 1; 1133 scanned = 1;
1136 } 1134 }
1137retry: 1135retry:
@@ -1167,7 +1165,7 @@ retry:
1167 break; 1165 break;
1168 } 1166 }
1169 1167
1170 if (unlikely(is_range) && (page->index > end)) { 1168 if (!wbc->range_cyclic && page->index > end) {
1171 done = 1; 1169 done = 1;
1172 unlock_page(page); 1170 unlock_page(page);
1173 break; 1171 break;
@@ -1271,7 +1269,7 @@ retry:
1271 index = 0; 1269 index = 0;
1272 goto retry; 1270 goto retry;
1273 } 1271 }
1274 if (!is_range) 1272 if (wbc->range_cyclic || (range_whole && wbc->nr_to_write > 0))
1275 mapping->writeback_index = index; 1273 mapping->writeback_index = index;
1276 1274
1277 FreeXid(xid); 1275 FreeXid(xid);
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index f3fbe2d030f4..6db95cf3aaa2 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -461,6 +461,8 @@ void sync_inodes_sb(struct super_block *sb, int wait)
461{ 461{
462 struct writeback_control wbc = { 462 struct writeback_control wbc = {
463 .sync_mode = wait ? WB_SYNC_ALL : WB_SYNC_HOLD, 463 .sync_mode = wait ? WB_SYNC_ALL : WB_SYNC_HOLD,
464 .range_start = 0,
465 .range_end = LLONG_MAX,
464 }; 466 };
465 unsigned long nr_dirty = read_page_state(nr_dirty); 467 unsigned long nr_dirty = read_page_state(nr_dirty);
466 unsigned long nr_unstable = read_page_state(nr_unstable); 468 unsigned long nr_unstable = read_page_state(nr_unstable);
@@ -559,6 +561,8 @@ int write_inode_now(struct inode *inode, int sync)
559 struct writeback_control wbc = { 561 struct writeback_control wbc = {
560 .nr_to_write = LONG_MAX, 562 .nr_to_write = LONG_MAX,
561 .sync_mode = WB_SYNC_ALL, 563 .sync_mode = WB_SYNC_ALL,
564 .range_start = 0,
565 .range_end = LLONG_MAX,
562 }; 566 };
563 567
564 if (!mapping_cap_writeback_dirty(inode->i_mapping)) 568 if (!mapping_cap_writeback_dirty(inode->i_mapping))
diff --git a/fs/mpage.c b/fs/mpage.c
index 9bf2eb30e6f4..1e4598247d0b 100644
--- a/fs/mpage.c
+++ b/fs/mpage.c
@@ -707,9 +707,9 @@ mpage_writepages(struct address_space *mapping,
707 struct pagevec pvec; 707 struct pagevec pvec;
708 int nr_pages; 708 int nr_pages;
709 pgoff_t index; 709 pgoff_t index;
710 pgoff_t end = -1; /* Inclusive */ 710 pgoff_t end; /* Inclusive */
711 int scanned = 0; 711 int scanned = 0;
712 int is_range = 0; 712 int range_whole = 0;
713 713
714 if (wbc->nonblocking && bdi_write_congested(bdi)) { 714 if (wbc->nonblocking && bdi_write_congested(bdi)) {
715 wbc->encountered_congestion = 1; 715 wbc->encountered_congestion = 1;
@@ -721,16 +721,14 @@ mpage_writepages(struct address_space *mapping,
721 writepage = mapping->a_ops->writepage; 721 writepage = mapping->a_ops->writepage;
722 722
723 pagevec_init(&pvec, 0); 723 pagevec_init(&pvec, 0);
724 if (wbc->sync_mode == WB_SYNC_NONE) { 724 if (wbc->range_cyclic) {
725 index = mapping->writeback_index; /* Start from prev offset */ 725 index = mapping->writeback_index; /* Start from prev offset */
726 end = -1;
726 } else { 727 } else {
727 index = 0; /* whole-file sweep */ 728 index = wbc->range_start >> PAGE_CACHE_SHIFT;
728 scanned = 1; 729 end = wbc->range_end >> PAGE_CACHE_SHIFT;
729 } 730 if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX)
730 if (wbc->start || wbc->end) { 731 range_whole = 1;
731 index = wbc->start >> PAGE_CACHE_SHIFT;
732 end = wbc->end >> PAGE_CACHE_SHIFT;
733 is_range = 1;
734 scanned = 1; 732 scanned = 1;
735 } 733 }
736retry: 734retry:
@@ -759,7 +757,7 @@ retry:
759 continue; 757 continue;
760 } 758 }
761 759
762 if (unlikely(is_range) && page->index > end) { 760 if (!wbc->range_cyclic && page->index > end) {
763 done = 1; 761 done = 1;
764 unlock_page(page); 762 unlock_page(page);
765 continue; 763 continue;
@@ -810,7 +808,7 @@ retry:
810 index = 0; 808 index = 0;
811 goto retry; 809 goto retry;
812 } 810 }
813 if (!is_range) 811 if (wbc->range_cyclic || (range_whole && wbc->nr_to_write > 0))
814 mapping->writeback_index = index; 812 mapping->writeback_index = index;
815 if (bio) 813 if (bio)
816 mpage_bio_submit(WRITE, bio); 814 mpage_bio_submit(WRITE, bio);
diff --git a/fs/sync.c b/fs/sync.c
index aab5ffe77e9f..955aef04da28 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -100,7 +100,7 @@ asmlinkage long sys_sync_file_range(int fd, loff_t offset, loff_t nbytes,
100 } 100 }
101 101
102 if (nbytes == 0) 102 if (nbytes == 0)
103 endbyte = -1; 103 endbyte = LLONG_MAX;
104 else 104 else
105 endbyte--; /* inclusive */ 105 endbyte--; /* inclusive */
106 106