aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/xfs/linux-2.6/xfs_aops.c33
1 files changed, 13 insertions, 20 deletions
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c
index c3bc7690f043..86f57f61939b 100644
--- a/fs/xfs/linux-2.6/xfs_aops.c
+++ b/fs/xfs/linux-2.6/xfs_aops.c
@@ -682,8 +682,7 @@ xfs_convert_page(
682 loff_t tindex, 682 loff_t tindex,
683 struct xfs_bmbt_irec *imap, 683 struct xfs_bmbt_irec *imap,
684 xfs_ioend_t **ioendp, 684 xfs_ioend_t **ioendp,
685 struct writeback_control *wbc, 685 struct writeback_control *wbc)
686 int all_bh)
687{ 686{
688 struct buffer_head *bh, *head; 687 struct buffer_head *bh, *head;
689 xfs_off_t end_offset; 688 xfs_off_t end_offset;
@@ -738,11 +737,14 @@ xfs_convert_page(
738 continue; 737 continue;
739 } 738 }
740 739
741 if (buffer_unwritten(bh) || buffer_delay(bh)) { 740 if (buffer_unwritten(bh) || buffer_delay(bh) ||
741 buffer_mapped(bh)) {
742 if (buffer_unwritten(bh)) 742 if (buffer_unwritten(bh))
743 type = IO_UNWRITTEN; 743 type = IO_UNWRITTEN;
744 else 744 else if (buffer_delay(bh))
745 type = IO_DELALLOC; 745 type = IO_DELALLOC;
746 else
747 type = IO_OVERWRITE;
746 748
747 if (!xfs_imap_valid(inode, imap, offset)) { 749 if (!xfs_imap_valid(inode, imap, offset)) {
748 done = 1; 750 done = 1;
@@ -752,23 +754,17 @@ xfs_convert_page(
752 ASSERT(imap->br_startblock != HOLESTARTBLOCK); 754 ASSERT(imap->br_startblock != HOLESTARTBLOCK);
753 ASSERT(imap->br_startblock != DELAYSTARTBLOCK); 755 ASSERT(imap->br_startblock != DELAYSTARTBLOCK);
754 756
755 xfs_map_at_offset(inode, bh, imap, offset); 757 if (type == IO_OVERWRITE)
758 lock_buffer(bh);
759 else
760 xfs_map_at_offset(inode, bh, imap, offset);
756 xfs_add_to_ioend(inode, bh, offset, type, 761 xfs_add_to_ioend(inode, bh, offset, type,
757 ioendp, done); 762 ioendp, done);
758 763
759 page_dirty--; 764 page_dirty--;
760 count++; 765 count++;
761 } else { 766 } else {
762 type = IO_OVERWRITE; 767 done = 1;
763 if (buffer_mapped(bh) && all_bh) {
764 lock_buffer(bh);
765 xfs_add_to_ioend(inode, bh, offset,
766 type, ioendp, done);
767 count++;
768 page_dirty--;
769 } else {
770 done = 1;
771 }
772 } 768 }
773 } while (offset += len, (bh = bh->b_this_page) != head); 769 } while (offset += len, (bh = bh->b_this_page) != head);
774 770
@@ -800,7 +796,6 @@ xfs_cluster_write(
800 struct xfs_bmbt_irec *imap, 796 struct xfs_bmbt_irec *imap,
801 xfs_ioend_t **ioendp, 797 xfs_ioend_t **ioendp,
802 struct writeback_control *wbc, 798 struct writeback_control *wbc,
803 int all_bh,
804 pgoff_t tlast) 799 pgoff_t tlast)
805{ 800{
806 struct pagevec pvec; 801 struct pagevec pvec;
@@ -815,7 +810,7 @@ xfs_cluster_write(
815 810
816 for (i = 0; i < pagevec_count(&pvec); i++) { 811 for (i = 0; i < pagevec_count(&pvec); i++) {
817 done = xfs_convert_page(inode, pvec.pages[i], tindex++, 812 done = xfs_convert_page(inode, pvec.pages[i], tindex++,
818 imap, ioendp, wbc, all_bh); 813 imap, ioendp, wbc);
819 if (done) 814 if (done)
820 break; 815 break;
821 } 816 }
@@ -929,7 +924,6 @@ xfs_vm_writepage(
929 ssize_t len; 924 ssize_t len;
930 int err, imap_valid = 0, uptodate = 1; 925 int err, imap_valid = 0, uptodate = 1;
931 int count = 0; 926 int count = 0;
932 int all_bh = 0;
933 int nonblocking = 0; 927 int nonblocking = 0;
934 928
935 trace_xfs_writepage(inode, page, 0); 929 trace_xfs_writepage(inode, page, 0);
@@ -1065,7 +1059,6 @@ xfs_vm_writepage(
1065 } 1059 }
1066 1060
1067 if (imap_valid) { 1061 if (imap_valid) {
1068 all_bh = 1;
1069 lock_buffer(bh); 1062 lock_buffer(bh);
1070 xfs_add_to_ioend(inode, bh, offset, type, 1063 xfs_add_to_ioend(inode, bh, offset, type,
1071 &ioend, new_ioend); 1064 &ioend, new_ioend);
@@ -1102,7 +1095,7 @@ xfs_vm_writepage(
1102 end_index = last_index; 1095 end_index = last_index;
1103 1096
1104 xfs_cluster_write(inode, page->index + 1, &imap, &ioend, 1097 xfs_cluster_write(inode, page->index + 1, &imap, &ioend,
1105 wbc, all_bh, end_index); 1098 wbc, end_index);
1106 } 1099 }
1107 1100
1108 if (iohead) 1101 if (iohead)