1. 01 8月, 2017 3 次提交
    • C
      f2fs: support project quota · 5c57132e
      Chao Yu 提交于
      This patch adds to support plain project quota.
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      5c57132e
    • C
      f2fs: enhance on-disk inode structure scalability · 7a2af766
      Chao Yu 提交于
      This patch add new flag F2FS_EXTRA_ATTR storing in inode.i_inline
      to indicate that on-disk structure of current inode is extended.
      
      In order to extend, we changed the inode structure a bit:
      
      Original one:
      
      struct f2fs_inode {
      	...
      	struct f2fs_extent i_ext;
      	__le32 i_addr[DEF_ADDRS_PER_INODE];
      	__le32 i_nid[DEF_NIDS_PER_INODE];
      }
      
      Extended one:
      
      struct f2fs_inode {
              ...
              struct f2fs_extent i_ext;
      	union {
      		struct {
      			__le16 i_extra_isize;
      			__le16 i_padding;
      			__le32 i_extra_end[0];
      		};
      		__le32 i_addr[DEF_ADDRS_PER_INODE];
      	};
              __le32 i_nid[DEF_NIDS_PER_INODE];
      }
      
      Once F2FS_EXTRA_ATTR is set, we will steal four bytes in the head of
      i_addr field for storing i_extra_isize and i_padding. with i_extra_isize,
      we can calculate actual size of reserved space in i_addr, available
      attribute fields included in total extra attribute fields for current
      inode can be described as below:
      
        +--------------------+
        | .i_mode            |
        | ...                |
        | .i_ext             |
        +--------------------+
        | .i_extra_isize     |-----+
        | .i_padding         |     |
        | .i_prjid           |     |
        | .i_atime_extra     |     |
        | .i_ctime_extra     |     |
        | .i_mtime_extra     |<----+
        | .i_inode_cs        |<----- store blkaddr/inline from here
        | .i_xattr_cs        |
        | ...                |
        +--------------------+
        |                    |
        |    block address   |
        |                    |
        +--------------------+
        | .i_nid             |
        +--------------------+
        |   node_footer      |
        | (nid, ino, offset) |
        +--------------------+
      
      Hence, with this patch, we would enhance scalability of f2fs inode for
      storing more newly added attribute.
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      7a2af766
    • C
      f2fs: make max inline size changeable · f2470371
      Chao Yu 提交于
      This patch tries to make below macros calculating max inline size,
      inline dentry field size considerring reserving size-changeable
      space:
      - MAX_INLINE_DATA
      - NR_INLINE_DENTRY
      - INLINE_DENTRY_BITMAP_SIZE
      - INLINE_RESERVED_SIZE
      
      Then, when inline_{data,dentry} options is enabled, it allows us to
      reserve inline space with different size flexibly for adding newly
      introduced inode attribute.
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      f2470371
  2. 09 7月, 2017 1 次提交
    • C
      f2fs: support plain user/group quota · 0abd675e
      Chao Yu 提交于
      This patch adds to support plain user/group quota.
      
      Change Note by Jaegeuk Kim.
      
      - Use f2fs page cache for quota files in order to consider garbage collection.
        so, quota files are not tolerable for sudden power-cuts, so user needs to do
        quotacheck.
      
      - setattr() calls dquot_transfer which will transfer inode->i_blocks.
        We can't reclaim that during f2fs_evict_inode(). So, we need to count
        node blocks as well in order to match i_blocks with dquot's space.
      
        Note that, Chao wrote a patch to count inode->i_blocks without inode block.
        (f2fs: don't count inode block in in-memory inode.i_blocks)
      
      - in f2fs_remount, we need to make RW in prior to dquot_resume.
      
      - handle fault_injection case during f2fs_quota_off_umount
      
      - TODO: Project quota
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      0abd675e
  3. 08 7月, 2017 1 次提交
    • C
      f2fs: don't count inode block in in-memory inode.i_blocks · 000519f2
      Chao Yu 提交于
      Previously, we count all inode consumed blocks including inode block,
      xattr block, index block, data block into i_blocks, for other generic
      filesystems, they won't count inode block into i_blocks, so for
      userspace applications or quota system, they may detect incorrect block
      count according to i_blocks value in inode.
      
      This patch changes to count all blocks into inode.i_blocks excluding
      inode block, for on-disk i_blocks, we keep counting inode block for
      backward compatibility.
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      000519f2
  4. 04 7月, 2017 2 次提交
    • C
      f2fs: measure inode.i_blocks as generic filesystem · 0eb0adad
      Chao Yu 提交于
      Both in memory or on disk, generic filesystems record i_blocks with
      512bytes sized sector count, also VFS sub module such as disk quota
      follows this rule, but f2fs records it with 4096bytes sized block
      count, this difference leads to that once we use dquota's function
      which inc/dec iblocks, it will make i_blocks of f2fs being inconsistent
      between in memory and on disk.
      
      In order to resolve this issue, this patch changes to make in-memory
      i_blocks of f2fs recording sector count instead of block count,
      meanwhile leaving on-disk i_blocks recording block count.
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      0eb0adad
    • J
      f2fs: remove false-positive bug_on · d8c4256c
      Jaegeuk Kim 提交于
      For example,
      
      f2fs_create
       - new_node_page is failed
       - handle_failed_inode
        - skip to add it into orphan list, since ni.blk_addr == NULL_ADDR
         : set_inode_flag(inode, FI_FREE_NID)
      
      f2fs_evict_inode
       - EIO due to fault injection
       - f2fs_bug_on() is triggered
      
      So, we don't need to call f2fs_bug_on in this case.
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      d8c4256c
  5. 24 5月, 2017 1 次提交
    • J
      f2fs: load inode's flag from disk · 93607124
      Jaegeuk Kim 提交于
      This patch fixes missing inode flag loaded from disk, reported by Tom.
      
      [tom@localhost ~]$ sudo mount /dev/loop0 /mnt/
      [tom@localhost ~]$ sudo chown tom:tom /mnt/
      [tom@localhost ~]$ touch /mnt/testfile
      [tom@localhost ~]$ sudo chattr +i /mnt/testfile
      [tom@localhost ~]$ echo test > /mnt/testfile
      bash: /mnt/testfile: Operation not permitted
      [tom@localhost ~]$ rm /mnt/testfile
      rm: cannot remove '/mnt/testfile': Operation not permitted
      [tom@localhost ~]$ sudo umount /mnt/
      [tom@localhost ~]$ sudo mount /dev/loop0 /mnt/
      [tom@localhost ~]$ lsattr /mnt/testfile
      ----i-------------- /mnt/testfile
      [tom@localhost ~]$ echo test > /mnt/testfile
      [tom@localhost ~]$ rm /mnt/testfile
      [tom@localhost ~]$ sudo umount /mnt/
      
      Cc: stable@vger.kernel.org
      Reported-by: NTom Yan <tom.ty89@outlook.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      93607124
  6. 25 4月, 2017 1 次提交
    • J
      f2fs: fix out-of free segments · a7881893
      Jaegeuk Kim 提交于
      This patch also reverts d0db7703 ("f2fs: do SSR in higher priority").
      
      This patch fixes out of free segments caused by many small file creation by
      1) mkfs -s 1 2G
      2) mount
      3) untar
       - preoduce 60000 small files burstly
      4) sync
       - flush node pages
       - flush imeta
      
      Here, when we do f2fs_balance_fs, we missed # of imeta blocks, resulting in
      skipping to check has_not_enough_free_secs.
      
      Another test is done by
      1) mkfs -s 12 2G
      2) mount
      3) untar
       - preoduce 60000 small files burstly
      4) sync
       - flush node pages
       - flush imeta
      
      In this case, this patch also fixes wrong block allocation under large section
      size.
      Reported-by: NWilliam Brana <wbrana@gmail.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      a7881893
  7. 13 4月, 2017 1 次提交
    • J
      f2fs: fix fs corruption due to zero inode page · 9bb02c36
      Jaegeuk Kim 提交于
      This patch fixes the following scenario.
      
      - f2fs_create/f2fs_mkdir             - write_checkpoint
       - f2fs_mark_inode_dirty_sync         - block_operations
                                             - f2fs_lock_all
                                             - f2fs_sync_inode_meta
                                              - f2fs_unlock_all
                                              - sync_inode_metadata
       - f2fs_lock_op
                                               - f2fs_write_inode
                                                - update_inode_page
                                                 - get_node_page
                                                   return -ENOENT
       - new_inode_page
        - fill_node_footer
       - f2fs_mark_inode_dirty_sync
       - ...
       - f2fs_unlock_op
                                                - f2fs_inode_synced
                                             - f2fs_lock_all
                                             - do_checkpoint
      
      In this checkpoint, we can get an inode page which contains zeros having valid
      node footer only.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      9bb02c36
  8. 22 3月, 2017 2 次提交
  9. 28 2月, 2017 1 次提交
  10. 24 11月, 2016 5 次提交
  11. 01 10月, 2016 1 次提交
    • C
      f2fs: support configuring fault injection per superblock · 1ecc0c5c
      Chao Yu 提交于
      Previously, we only support global fault injection configuration, so that
      when we configure type/rate of fault injection through sysfs, mount
      option, it will influence all f2fs partition which is being used.
      
      It is not make sence, since it will be not convenient if developer want
      to test separated partitions with different fault injection rate/type
      simultaneously, also it's not possible to enable fault injection in one
      partition and disable fault injection in other one.
      
      >From now on, we move global configuration of fault injection in module
      into per-superblock, hence injection testing can be more flexible.
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      1ecc0c5c
  12. 14 9月, 2016 1 次提交
  13. 09 7月, 2016 1 次提交
  14. 07 7月, 2016 1 次提交
  15. 08 6月, 2016 2 次提交
  16. 03 6月, 2016 5 次提交
  17. 21 5月, 2016 1 次提交
  18. 08 5月, 2016 3 次提交
  19. 18 3月, 2016 1 次提交
    • J
      fs crypto: move per-file encryption from f2fs tree to fs/crypto · 0b81d077
      Jaegeuk Kim 提交于
      This patch adds the renamed functions moved from the f2fs crypto files.
      
      1. definitions for per-file encryption used by ext4 and f2fs.
      
      2. crypto.c for encrypt/decrypt functions
       a. IO preparation:
        - fscrypt_get_ctx / fscrypt_release_ctx
       b. before IOs:
        - fscrypt_encrypt_page
        - fscrypt_decrypt_page
        - fscrypt_zeroout_range
       c. after IOs:
        - fscrypt_decrypt_bio_pages
        - fscrypt_pullback_bio_page
        - fscrypt_restore_control_page
      
      3. policy.c supporting context management.
       a. For ioctls:
        - fscrypt_process_policy
        - fscrypt_get_policy
       b. For context permission
        - fscrypt_has_permitted_context
        - fscrypt_inherit_context
      
      4. keyinfo.c to handle permissions
        - fscrypt_get_encryption_info
        - fscrypt_free_encryption_info
      
      5. fname.c to support filename encryption
       a. general wrapper functions
        - fscrypt_fname_disk_to_usr
        - fscrypt_fname_usr_to_disk
        - fscrypt_setup_filename
        - fscrypt_free_filename
      
       b. specific filename handling functions
        - fscrypt_fname_alloc_buffer
        - fscrypt_fname_free_buffer
      
      6. Makefile and Kconfig
      
      Cc: Al Viro <viro@ftp.linux.org.uk>
      Signed-off-by: NMichael Halcrow <mhalcrow@google.com>
      Signed-off-by: NIldar Muslukhov <ildarm@google.com>
      Signed-off-by: NUday Savagaonkar <savagaon@google.com>
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      0b81d077
  20. 23 2月, 2016 3 次提交
  21. 09 1月, 2016 2 次提交
  22. 31 12月, 2015 1 次提交
    • J
      f2fs: load largest extent all the time · ed3d1256
      Jaegeuk Kim 提交于
      Otherwise, we can get mismatched largest extent information.
      
      One example is:
      1. mount f2fs w/ extent_cache
      2. make a small extent
      3. umount
      4. mount f2fs w/o extent_cache
      5. update the largest extent
      6. umount
      7. mount f2fs w/ extent_cache
      8. get the old extent made by #2Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      ed3d1256