~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to fs/ext4/page-io.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
203
203
        for (i = 0; i < io_end->num_io_pages; i++) {
204
204
                struct page *page = io_end->pages[i]->p_page;
205
205
                struct buffer_head *bh, *head;
206
 
                int partial_write = 0;
 
206
                loff_t offset;
 
207
                loff_t io_end_offset;
207
208
 
208
 
                head = page_buffers(page);
209
 
                if (error)
 
209
                if (error) {
210
210
                        SetPageError(page);
211
 
                BUG_ON(!head);
212
 
                if (head->b_size != PAGE_CACHE_SIZE) {
213
 
                        loff_t offset;
214
 
                        loff_t io_end_offset = io_end->offset + io_end->size;
 
211
                        set_bit(AS_EIO, &page->mapping->flags);
 
212
                        head = page_buffers(page);
 
213
                        BUG_ON(!head);
 
214
 
 
215
                        io_end_offset = io_end->offset + io_end->size;
215
216
 
216
217
                        offset = (sector_t) page->index << PAGE_CACHE_SHIFT;
217
218
                        bh = head;
218
219
                        do {
219
220
                                if ((offset >= io_end->offset) &&
220
 
                                    (offset+bh->b_size <= io_end_offset)) {
221
 
                                        if (error)
222
 
                                                buffer_io_error(bh);
 
221
                                    (offset+bh->b_size <= io_end_offset))
 
222
                                        buffer_io_error(bh);
223
223
 
224
 
                                }
225
 
                                if (buffer_delay(bh))
226
 
                                        partial_write = 1;
227
 
                                else if (!buffer_mapped(bh))
228
 
                                        clear_buffer_dirty(bh);
229
 
                                else if (buffer_dirty(bh))
230
 
                                        partial_write = 1;
231
224
                                offset += bh->b_size;
232
225
                                bh = bh->b_this_page;
233
226
                        } while (bh != head);
234
227
                }
235
228
 
236
 
                /*
237
 
                 * If this is a partial write which happened to make
238
 
                 * all buffers uptodate then we can optimize away a
239
 
                 * bogus readpage() for the next read(). Here we
240
 
                 * 'discover' whether the page went uptodate as a
241
 
                 * result of this (potentially partial) write.
242
 
                 */
243
 
                if (!partial_write)
244
 
                        SetPageUptodate(page);
245
 
 
246
229
                put_io_page(io_end->pages[i]);
247
230
        }
248
231
        io_end->num_io_pages = 0;
259
242
                             bi_sector >> (inode->i_blkbits - 9));
260
243
        }
261
244
 
 
245
        if (!(io_end->flag & EXT4_IO_END_UNWRITTEN)) {
 
246
                ext4_free_io_end(io_end);
 
247
                return;
 
248
        }
 
249
 
262
250
        /* Add the io_end to per-inode completed io list*/
263
251
        spin_lock_irqsave(&EXT4_I(inode)->i_completed_io_lock, flags);
264
252
        list_add_tail(&io_end->list, &EXT4_I(inode)->i_completed_io_list);
279
267
                BUG_ON(bio_flagged(io->io_bio, BIO_EOPNOTSUPP));
280
268
                bio_put(io->io_bio);
281
269
        }
282
 
        io->io_bio = 0;
 
270
        io->io_bio = NULL;
283
271
        io->io_op = 0;
284
 
        io->io_end = 0;
 
272
        io->io_end = NULL;
285
273
}
286
274
 
287
275
static int io_submit_init(struct ext4_io_submit *io,
310
298
        io_end->offset = (page->index << PAGE_CACHE_SHIFT) + bh_offset(bh);
311
299
 
312
300
        io->io_bio = bio;
313
 
        io->io_op = (wbc->sync_mode == WB_SYNC_ALL ?
314
 
                        WRITE_SYNC_PLUG : WRITE);
 
301
        io->io_op = (wbc->sync_mode == WB_SYNC_ALL ?  WRITE_SYNC : WRITE);
315
302
        io->io_next_block = bh->b_blocknr;
316
303
        return 0;
317
304
}
381
368
 
382
369
        BUG_ON(!PageLocked(page));
383
370
        BUG_ON(PageWriteback(page));
384
 
        set_page_writeback(page);
385
 
        ClearPageError(page);
386
371
 
387
372
        io_page = kmem_cache_alloc(io_page_cachep, GFP_NOFS);
388
373
        if (!io_page) {
393
378
        io_page->p_page = page;
394
379
        atomic_set(&io_page->p_count, 1);
395
380
        get_page(page);
 
381
        set_page_writeback(page);
 
382
        ClearPageError(page);
396
383
 
397
384
        for (bh = head = page_buffers(page), block_start = 0;
398
385
             bh != head || !block_start;