OSDN Git Service

Merge upstream-f2fs-stable-linux-4.4.y into android-4.4
authorJaegeuk Kim <jaegeuk@google.com>
Tue, 14 May 2019 21:24:13 +0000 (14:24 -0700)
committerJaegeuk Kim <jaegeuk@google.com>
Tue, 14 May 2019 21:24:13 +0000 (14:24 -0700)
* origin/upstream-f2fs-stable-linux-4.4.y:
  f2fs: fix to avoid accessing xattr across the boundary
  f2fs: fix to avoid potential race on sbi->unusable_block_count access/update
  f2fs: add tracepoint for f2fs_filemap_fault()
  f2fs: introduce DATA_GENERIC_ENHANCE
  f2fs: fix to handle error in f2fs_disable_checkpoint()
  f2fs: remove redundant check in f2fs_file_write_iter()
  f2fs: fix to be aware of readonly device in write_checkpoint()
  f2fs: fix to skip recovery on readonly device
  f2fs: fix to consider multiple device for readonly check
  f2fs: relocate chksum_offset for large_nat_bitmap feature
  f2fs: allow unfixed f2fs_checkpoint.checksum_offset
  f2fs: Replace spaces with tab
  f2fs: insert space before the open parenthesis '('
  f2fs: allow address pointer number of dnode aligning to specified size
  f2fs: introduce f2fs_read_single_page() for cleanup
  f2fs: mark is_extension_exist() inline
  f2fs: fix to set FI_UPDATE_WRITE correctly
  f2fs: fix to avoid panic in f2fs_inplace_write_data()
  f2fs: fix to do sanity check on valid block count of segment
  f2fs: fix to do sanity check on valid node/block count
  f2fs: fix to avoid panic in do_recover_data()
  f2fs: fix to do sanity check on free nid
  f2fs: fix to do checksum even if inode page is uptodate
  f2fs: fix to avoid panic in f2fs_remove_inode_page()
  f2fs: fix to clear dirty inode in error path of f2fs_iget()
  f2fs: remove new blank line of f2fs kernel message
  f2fs: fix wrong __is_meta_io() macro
  f2fs: fix to avoid panic in dec_valid_node_count()
  f2fs: fix to avoid panic in dec_valid_block_count()
  f2fs: fix to use inline space only if inline_xattr is enable
  f2fs: fix to retrieve inline xattr space
  f2fs: fix error path of recovery
  f2fs: fix to avoid deadloop in foreground GC
  f2fs: data: fix warning Using plain integer as NULL pointer
  f2fs: add tracepoint for f2fs_file_write_iter()
  f2fs: add comment for conditional compilation statement
  f2fs: fix potential recursive call when enabling data_flush
  f2fs: improve discard handling with multi-device volumes
  f2fs: Reduce zoned block device memory usage
  f2fs: Fix use of number of devices

Change-Id: I5df9e9906428ef2eb852838ec4f598599e0e5c63
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
1  2 
fs/f2fs/data.c
fs/f2fs/f2fs.h
fs/f2fs/inline.c
fs/f2fs/namei.c

diff --cc fs/f2fs/data.c
@@@ -633,8 -600,8 +636,8 @@@ static int f2fs_submit_page_read(struc
                return -EFAULT;
        }
        ClearPageError(page);
-       inc_page_count(F2FS_I_SB(inode), F2FS_RD_DATA);
-       __f2fs_submit_read_bio(F2FS_I_SB(inode), bio, DATA);
+       inc_page_count(sbi, F2FS_RD_DATA);
 -      __submit_bio(sbi, bio, DATA);
++      __f2fs_submit_read_bio(sbi, bio, DATA);
        return 0;
  }
  
        return ret;
  }
  
 -              __submit_bio(F2FS_I_SB(inode), bio, DATA);
+ static int f2fs_read_single_page(struct inode *inode, struct page *page,
+                                       unsigned nr_pages,
+                                       struct f2fs_map_blocks *map,
+                                       struct bio **bio_ret,
+                                       sector_t *last_block_in_bio,
+                                       bool is_readahead)
+ {
+       struct bio *bio = *bio_ret;
+       const unsigned blkbits = inode->i_blkbits;
+       const unsigned blocksize = 1 << blkbits;
+       sector_t block_in_file;
+       sector_t last_block;
+       sector_t last_block_in_file;
+       sector_t block_nr;
+       int ret = 0;
+       block_in_file = (sector_t)page->index;
+       last_block = block_in_file + nr_pages;
+       last_block_in_file = (i_size_read(inode) + blocksize - 1) >>
+                                                       blkbits;
+       if (last_block > last_block_in_file)
+               last_block = last_block_in_file;
+       /* just zeroing out page which is beyond EOF */
+       if (block_in_file >= last_block)
+               goto zero_out;
+       /*
+        * Map blocks using the previous result first.
+        */
+       if ((map->m_flags & F2FS_MAP_MAPPED) &&
+                       block_in_file > map->m_lblk &&
+                       block_in_file < (map->m_lblk + map->m_len))
+               goto got_it;
+       /*
+        * Then do more f2fs_map_blocks() calls until we are
+        * done with this page.
+        */
+       map->m_lblk = block_in_file;
+       map->m_len = last_block - block_in_file;
+       ret = f2fs_map_blocks(inode, map, 0, F2FS_GET_BLOCK_DEFAULT);
+       if (ret)
+               goto out;
+ got_it:
+       if ((map->m_flags & F2FS_MAP_MAPPED)) {
+               block_nr = map->m_pblk + block_in_file - map->m_lblk;
+               SetPageMappedToDisk(page);
+               if (!PageUptodate(page) && !cleancache_get_page(page)) {
+                       SetPageUptodate(page);
+                       goto confused;
+               }
+               if (!f2fs_is_valid_blkaddr(F2FS_I_SB(inode), block_nr,
+                                               DATA_GENERIC_ENHANCE_READ)) {
+                       ret = -EFAULT;
+                       goto out;
+               }
+       } else {
+ zero_out:
+               zero_user_segment(page, 0, PAGE_SIZE);
+               if (!PageUptodate(page))
+                       SetPageUptodate(page);
+               unlock_page(page);
+               goto out;
+       }
+       /*
+        * This page will go to BIO.  Do we need to send this
+        * BIO off first?
+        */
+       if (bio && (*last_block_in_bio != block_nr - 1 ||
+               !__same_bdev(F2FS_I_SB(inode), block_nr, bio))) {
+ submit_and_realloc:
 -              __submit_bio(F2FS_I_SB(inode), bio, DATA);
++              __f2fs_submit_read_bio(F2FS_I_SB(inode), bio, DATA);
+               bio = NULL;
+       }
+       if (bio == NULL) {
+               bio = f2fs_grab_read_bio(inode, block_nr, nr_pages,
+                               is_readahead ? REQ_RAHEAD : 0);
+               if (IS_ERR(bio)) {
+                       ret = PTR_ERR(bio);
+                       bio = NULL;
+                       goto out;
+               }
+       }
+       /*
+        * If the page is under writeback, we need to wait for
+        * its completion to see the correct decrypted data.
+        */
+       f2fs_wait_on_block_writeback(inode, block_nr);
+       if (bio_add_page(bio, page, blocksize, 0) < blocksize)
+               goto submit_and_realloc;
+       inc_page_count(F2FS_I_SB(inode), F2FS_RD_DATA);
+       ClearPageError(page);
+       *last_block_in_bio = block_nr;
+       goto out;
+ confused:
+       if (bio) {
++              __f2fs_submit_read_bio(F2FS_I_SB(inode), bio, DATA);
+               bio = NULL;
+       }
+       unlock_page(page);
+ out:
+       *bio_ret = bio;
+       return ret;
+ }
  /*
   * This function was originally taken from fs/mpage.c, and customized for f2fs.
   * Major change was from block_size == page_size in f2fs by default.
@@@ -1674,8 -1675,8 +1711,8 @@@ next_page
        }
        BUG_ON(pages && !list_empty(pages));
        if (bio)
 -              __submit_bio(F2FS_I_SB(inode), bio, DATA);
 +              __f2fs_submit_read_bio(F2FS_I_SB(inode), bio, DATA);
-       return 0;
+       return pages ? 0 : ret;
  }
  
  static int f2fs_read_data_page(struct file *file, struct page *page)
diff --cc fs/f2fs/f2fs.h
Simple merge
Simple merge
diff --cc fs/f2fs/namei.c
Simple merge