inode.c (871cafcc962fa1655c44b4f0e54d4c5cc14e273c) inode.c (2acf2c261b823d9d9ed954f348b97620297a36b5)
1/*
2 * linux/fs/ext4/inode.c
3 *
4 * Copyright (C) 1992, 1993, 1994, 1995
5 * Remy Card (card@masi.ibp.fr)
6 * Laboratoire MASI - Institut Blaise Pascal
7 * Universite Pierre et Marie Curie (Paris VI)
8 *

--- 33 unchanged lines hidden (view full) ---

42#include "acl.h"
43#include "ext4_extents.h"
44
45#define MPAGE_DA_EXTENT_TAIL 0x01
46
47static inline int ext4_begin_ordered_truncate(struct inode *inode,
48 loff_t new_size)
49{
1/*
2 * linux/fs/ext4/inode.c
3 *
4 * Copyright (C) 1992, 1993, 1994, 1995
5 * Remy Card (card@masi.ibp.fr)
6 * Laboratoire MASI - Institut Blaise Pascal
7 * Universite Pierre et Marie Curie (Paris VI)
8 *

--- 33 unchanged lines hidden (view full) ---

42#include "acl.h"
43#include "ext4_extents.h"
44
45#define MPAGE_DA_EXTENT_TAIL 0x01
46
47static inline int ext4_begin_ordered_truncate(struct inode *inode,
48 loff_t new_size)
49{
50 return jbd2_journal_begin_ordered_truncate(&EXT4_I(inode)->jinode,
51 new_size);
50 return jbd2_journal_begin_ordered_truncate(
51 EXT4_SB(inode->i_sb)->s_journal,
52 &EXT4_I(inode)->jinode,
53 new_size);
52}
53
54static void ext4_invalidatepage(struct page *page, unsigned long offset);
55
56/*
57 * Test whether an inode is a fast symlink.
58 */
59static int ext4_inode_is_fast_symlink(struct inode *inode)

--- 2372 unchanged lines hidden (view full) ---

2432 pgoff_t index;
2433 int range_whole = 0;
2434 handle_t *handle = NULL;
2435 struct mpage_da_data mpd;
2436 struct inode *inode = mapping->host;
2437 int no_nrwrite_index_update;
2438 int pages_written = 0;
2439 long pages_skipped;
54}
55
56static void ext4_invalidatepage(struct page *page, unsigned long offset);
57
58/*
59 * Test whether an inode is a fast symlink.
60 */
61static int ext4_inode_is_fast_symlink(struct inode *inode)

--- 2372 unchanged lines hidden (view full) ---

2434 pgoff_t index;
2435 int range_whole = 0;
2436 handle_t *handle = NULL;
2437 struct mpage_da_data mpd;
2438 struct inode *inode = mapping->host;
2439 int no_nrwrite_index_update;
2440 int pages_written = 0;
2441 long pages_skipped;
2442 int range_cyclic, cycled = 1, io_done = 0;
2440 int needed_blocks, ret = 0, nr_to_writebump = 0;
2441 struct ext4_sb_info *sbi = EXT4_SB(mapping->host->i_sb);
2442
2443 trace_mark(ext4_da_writepages,
2444 "dev %s ino %lu nr_t_write %ld "
2445 "pages_skipped %ld range_start %llu "
2446 "range_end %llu nonblocking %d "
2447 "for_kupdate %d for_reclaim %d "

--- 35 unchanged lines hidden (view full) ---

2483 */
2484 if (wbc->nr_to_write < sbi->s_mb_stream_request) {
2485 nr_to_writebump = sbi->s_mb_stream_request - wbc->nr_to_write;
2486 wbc->nr_to_write = sbi->s_mb_stream_request;
2487 }
2488 if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX)
2489 range_whole = 1;
2490
2443 int needed_blocks, ret = 0, nr_to_writebump = 0;
2444 struct ext4_sb_info *sbi = EXT4_SB(mapping->host->i_sb);
2445
2446 trace_mark(ext4_da_writepages,
2447 "dev %s ino %lu nr_t_write %ld "
2448 "pages_skipped %ld range_start %llu "
2449 "range_end %llu nonblocking %d "
2450 "for_kupdate %d for_reclaim %d "

--- 35 unchanged lines hidden (view full) ---

2486 */
2487 if (wbc->nr_to_write < sbi->s_mb_stream_request) {
2488 nr_to_writebump = sbi->s_mb_stream_request - wbc->nr_to_write;
2489 wbc->nr_to_write = sbi->s_mb_stream_request;
2490 }
2491 if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX)
2492 range_whole = 1;
2493
2491 if (wbc->range_cyclic)
2494 range_cyclic = wbc->range_cyclic;
2495 if (wbc->range_cyclic) {
2492 index = mapping->writeback_index;
2496 index = mapping->writeback_index;
2493 else
2497 if (index)
2498 cycled = 0;
2499 wbc->range_start = index << PAGE_CACHE_SHIFT;
2500 wbc->range_end = LLONG_MAX;
2501 wbc->range_cyclic = 0;
2502 } else
2494 index = wbc->range_start >> PAGE_CACHE_SHIFT;
2495
2496 mpd.wbc = wbc;
2497 mpd.inode = mapping->host;
2498
2499 /*
2500 * we don't want write_cache_pages to update
2501 * nr_to_write and writeback_index
2502 */
2503 no_nrwrite_index_update = wbc->no_nrwrite_index_update;
2504 wbc->no_nrwrite_index_update = 1;
2505 pages_skipped = wbc->pages_skipped;
2506
2503 index = wbc->range_start >> PAGE_CACHE_SHIFT;
2504
2505 mpd.wbc = wbc;
2506 mpd.inode = mapping->host;
2507
2508 /*
2509 * we don't want write_cache_pages to update
2510 * nr_to_write and writeback_index
2511 */
2512 no_nrwrite_index_update = wbc->no_nrwrite_index_update;
2513 wbc->no_nrwrite_index_update = 1;
2514 pages_skipped = wbc->pages_skipped;
2515
2516retry:
2507 while (!ret && wbc->nr_to_write > 0) {
2508
2509 /*
2510 * we insert one extent at a time. So we need
2511 * credit needed for single extent allocation.
2512 * journalled mode is currently not supported
2513 * by delalloc
2514 */

--- 26 unchanged lines hidden (view full) ---

2541 } else if (ret == MPAGE_DA_EXTENT_TAIL) {
2542 /*
2543 * got one extent now try with
2544 * rest of the pages
2545 */
2546 pages_written += mpd.pages_written;
2547 wbc->pages_skipped = pages_skipped;
2548 ret = 0;
2517 while (!ret && wbc->nr_to_write > 0) {
2518
2519 /*
2520 * we insert one extent at a time. So we need
2521 * credit needed for single extent allocation.
2522 * journalled mode is currently not supported
2523 * by delalloc
2524 */

--- 26 unchanged lines hidden (view full) ---

2551 } else if (ret == MPAGE_DA_EXTENT_TAIL) {
2552 /*
2553 * got one extent now try with
2554 * rest of the pages
2555 */
2556 pages_written += mpd.pages_written;
2557 wbc->pages_skipped = pages_skipped;
2558 ret = 0;
2559 io_done = 1;
2549 } else if (wbc->nr_to_write)
2550 /*
2551 * There is no more writeout needed
2552 * or we requested for a noblocking writeout
2553 * and we found the device congested
2554 */
2555 break;
2556 }
2560 } else if (wbc->nr_to_write)
2561 /*
2562 * There is no more writeout needed
2563 * or we requested for a noblocking writeout
2564 * and we found the device congested
2565 */
2566 break;
2567 }
2568 if (!io_done && !cycled) {
2569 cycled = 1;
2570 index = 0;
2571 wbc->range_start = index << PAGE_CACHE_SHIFT;
2572 wbc->range_end = mapping->writeback_index - 1;
2573 goto retry;
2574 }
2557 if (pages_skipped != wbc->pages_skipped)
2558 printk(KERN_EMERG "This should not happen leaving %s "
2559 "with nr_to_write = %ld ret = %d\n",
2560 __func__, wbc->nr_to_write, ret);
2561
2562 /* Update index */
2563 index += pages_written;
2575 if (pages_skipped != wbc->pages_skipped)
2576 printk(KERN_EMERG "This should not happen leaving %s "
2577 "with nr_to_write = %ld ret = %d\n",
2578 __func__, wbc->nr_to_write, ret);
2579
2580 /* Update index */
2581 index += pages_written;
2582 wbc->range_cyclic = range_cyclic;
2564 if (wbc->range_cyclic || (range_whole && wbc->nr_to_write > 0))
2565 /*
2566 * set the writeback_index so that range_cyclic
2567 * mode will write it back later
2568 */
2569 mapping->writeback_index = index;
2570
2571out_writepages:

--- 2577 unchanged lines hidden ---
2583 if (wbc->range_cyclic || (range_whole && wbc->nr_to_write > 0))
2584 /*
2585 * set the writeback_index so that range_cyclic
2586 * mode will write it back later
2587 */
2588 mapping->writeback_index = index;
2589
2590out_writepages:

--- 2577 unchanged lines hidden ---