struct datablock *b0 = NULL;
int blocks = PAGE_SIZE >> ino->i_blkbits;
int i;
- int rv = 0;
+ int redirty = 0;
dprintk("WRITEPAGE %lu\n", page->index);
for (i = 0 ; i < blocks; i++) {
struct datablock *b = lafs_get_block(ino, i, page, GFP_KERNEL,
*/
if (test_bit(B_Dirty, &b->b.flags)) {
if (test_bit(B_PinPending, &b->b.flags))
- rv = AOP_WRITEPAGE_ACTIVATE;
+ redirty = 1;
else if (LAFSI(ino)->type == TypeSegmentMap &&
!test_bit(CheckpointFlushing, &fs->fsstate))
/* FIXME or quota ?? */
- rv = AOP_WRITEPAGE_ACTIVATE;
+ redirty = 1;
else if (LAFSI(b->b.inode)->type == TypeInodeFile &&
b->my_inode &&
LAFSI(b->my_inode)->iblock)
- rv = AOP_WRITEPAGE_ACTIVATE;
+ redirty = 1;
else {
lafs_iolock_written(&b->b);
/* block might have been invalidated,
* while we waited too??
*/
if (test_bit(B_PinPending, &b->b.flags)) {
- rv = AOP_WRITEPAGE_ACTIVATE;
+ redirty = 1;
lafs_iounlock_block(&b->b);
} else if (test_bit(B_Dirty, &b->b.flags))
lafs_cluster_allocate(&b->b, 0);
}
putdref(b, MKREF(writepage));
}
- if (rv == 0) {
+ if (redirty)
+ redirty_page_for_writepage(wbc, page);
+ else {
if (b0) {
set_page_writeback(page);
set_bit(B_HaveWriteback, &b0->b.flags);
lafs_iocheck_writeback(b0, 0);
}
- unlock_page(page);
}
- if (!b0)
+ unlock_page(page);
+
+ if (b0)
+ putdref(b0, MKREF(writepage0));
+ if (!b0 || redirty)
return 0;
- putdref(b0, MKREF(writepage0));
- if (rv == 0 && wbc->for_writepages && LAFSI(ino)->depth == 0) {
+
+ if (wbc->for_writepages && LAFSI(ino)->depth == 0) {
/* We really want the data to be safe soon, not just
* the page to be clean.
* so write the inode.
// FIXME need to make sure a cluster_flush happens some time!!! if (wbc->sync_mode != WB_SYNC_NONE)
lafs_cluster_flush(fs, 0);
dprintk("WRITEPAGE flush\n");
- return rv;
+ return 0;
}
static void lafs_sync_page(struct page *page)