• Qu Wenruo's avatar
    btrfs: remove unnecessary @nr_written parameters · 83f1b680
    Qu Wenruo authored
    We use @nr_written to record how many pages have been started by
    btrfs_run_delalloc_range().
    
    Currently there are only two cases that would populate @nr_written:
    
    - Inline extent creation
    - Compressed write
    
    But both cases will also set @page_started to one.
    
    In fact, in writepage_delalloc() we have the following code, showing
    that @nr_written is really only utilized for above two cases:
    
    	/* did the fill delalloc function already unlock and start
    	 * the IO?
    	 */
    	if (page_started) {
    		/*
    		 * we've unlocked the page, so we can't update
    		 * the mapping's writeback index, just update
    		 * nr_to_write.
    		 */
    		wbc->nr_to_write -= nr_written;
    		return 1;
    	}
    
    But for such cases, writepage_delalloc() will return 1, and exit
    __extent_writepage() without going through __extent_writepage_io().
    
    Thus this means, inside __extent_writepage_io(), we always get
    @nr_written as 0.
    
    So this patch is going to remove the unnecessary parameter from the
    following functions:
    
    - writepage_delalloc()
    
      As @nr_written passed in is always the initial value 0.
    
      Although inside that function, we still need a local @nr_written
      to update wbc->nr_to_write.
    
    - __extent_writepage_io()
    
      As explained above, @nr_written passed in can only be 0.
    
      This also means we can remove one update_nr_written() call.
    Signed-off-by: default avatarQu Wenruo <wqu@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    83f1b680
extent_io.c 196 KB