diff options
Diffstat (limited to 'fs/f2fs/f2fs.h')
-rw-r--r-- | fs/f2fs/f2fs.h | 174 |
1 files changed, 141 insertions, 33 deletions
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 7fa3313ab0e2..c06a25e5cec3 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h | |||
@@ -50,6 +50,7 @@ | |||
50 | #define F2FS_MOUNT_FLUSH_MERGE 0x00000400 | 50 | #define F2FS_MOUNT_FLUSH_MERGE 0x00000400 |
51 | #define F2FS_MOUNT_NOBARRIER 0x00000800 | 51 | #define F2FS_MOUNT_NOBARRIER 0x00000800 |
52 | #define F2FS_MOUNT_FASTBOOT 0x00001000 | 52 | #define F2FS_MOUNT_FASTBOOT 0x00001000 |
53 | #define F2FS_MOUNT_EXTENT_CACHE 0x00002000 | ||
53 | 54 | ||
54 | #define clear_opt(sbi, option) (sbi->mount_opt.opt &= ~F2FS_MOUNT_##option) | 55 | #define clear_opt(sbi, option) (sbi->mount_opt.opt &= ~F2FS_MOUNT_##option) |
55 | #define set_opt(sbi, option) (sbi->mount_opt.opt |= F2FS_MOUNT_##option) | 56 | #define set_opt(sbi, option) (sbi->mount_opt.opt |= F2FS_MOUNT_##option) |
@@ -102,6 +103,7 @@ enum { | |||
102 | CP_UMOUNT, | 103 | CP_UMOUNT, |
103 | CP_FASTBOOT, | 104 | CP_FASTBOOT, |
104 | CP_SYNC, | 105 | CP_SYNC, |
106 | CP_RECOVERY, | ||
105 | CP_DISCARD, | 107 | CP_DISCARD, |
106 | }; | 108 | }; |
107 | 109 | ||
@@ -216,6 +218,15 @@ static inline bool __has_cursum_space(struct f2fs_summary_block *sum, int size, | |||
216 | #define F2FS_IOC_RELEASE_VOLATILE_WRITE _IO(F2FS_IOCTL_MAGIC, 4) | 218 | #define F2FS_IOC_RELEASE_VOLATILE_WRITE _IO(F2FS_IOCTL_MAGIC, 4) |
217 | #define F2FS_IOC_ABORT_VOLATILE_WRITE _IO(F2FS_IOCTL_MAGIC, 5) | 219 | #define F2FS_IOC_ABORT_VOLATILE_WRITE _IO(F2FS_IOCTL_MAGIC, 5) |
218 | 220 | ||
221 | /* | ||
222 | * should be same as XFS_IOC_GOINGDOWN. | ||
223 | * Flags for going down operation used by FS_IOC_GOINGDOWN | ||
224 | */ | ||
225 | #define F2FS_IOC_SHUTDOWN _IOR('X', 125, __u32) /* Shutdown */ | ||
226 | #define F2FS_GOING_DOWN_FULLSYNC 0x0 /* going down with full sync */ | ||
227 | #define F2FS_GOING_DOWN_METASYNC 0x1 /* going down with metadata */ | ||
228 | #define F2FS_GOING_DOWN_NOSYNC 0x2 /* going down */ | ||
229 | |||
219 | #if defined(__KERNEL__) && defined(CONFIG_COMPAT) | 230 | #if defined(__KERNEL__) && defined(CONFIG_COMPAT) |
220 | /* | 231 | /* |
221 | * ioctl commands in 32 bit emulation | 232 | * ioctl commands in 32 bit emulation |
@@ -273,14 +284,34 @@ enum { | |||
273 | 284 | ||
274 | #define MAX_DIR_RA_PAGES 4 /* maximum ra pages of dir */ | 285 | #define MAX_DIR_RA_PAGES 4 /* maximum ra pages of dir */ |
275 | 286 | ||
287 | /* vector size for gang look-up from extent cache that consists of radix tree */ | ||
288 | #define EXT_TREE_VEC_SIZE 64 | ||
289 | |||
276 | /* for in-memory extent cache entry */ | 290 | /* for in-memory extent cache entry */ |
277 | #define F2FS_MIN_EXTENT_LEN 16 /* minimum extent length */ | 291 | #define F2FS_MIN_EXTENT_LEN 64 /* minimum extent length */ |
292 | |||
293 | /* number of extent info in extent cache we try to shrink */ | ||
294 | #define EXTENT_CACHE_SHRINK_NUMBER 128 | ||
278 | 295 | ||
279 | struct extent_info { | 296 | struct extent_info { |
280 | rwlock_t ext_lock; /* rwlock for consistency */ | 297 | unsigned int fofs; /* start offset in a file */ |
281 | unsigned int fofs; /* start offset in a file */ | 298 | u32 blk; /* start block address of the extent */ |
282 | u32 blk_addr; /* start block address of the extent */ | 299 | unsigned int len; /* length of the extent */ |
283 | unsigned int len; /* length of the extent */ | 300 | }; |
301 | |||
302 | struct extent_node { | ||
303 | struct rb_node rb_node; /* rb node located in rb-tree */ | ||
304 | struct list_head list; /* node in global extent list of sbi */ | ||
305 | struct extent_info ei; /* extent info */ | ||
306 | }; | ||
307 | |||
308 | struct extent_tree { | ||
309 | nid_t ino; /* inode number */ | ||
310 | struct rb_root root; /* root of extent info rb-tree */ | ||
311 | struct extent_node *cached_en; /* recently accessed extent node */ | ||
312 | rwlock_t lock; /* protect extent info rb-tree */ | ||
313 | atomic_t refcount; /* reference count of rb-tree */ | ||
314 | unsigned int count; /* # of extent node in rb-tree*/ | ||
284 | }; | 315 | }; |
285 | 316 | ||
286 | /* | 317 | /* |
@@ -309,6 +340,7 @@ struct f2fs_inode_info { | |||
309 | nid_t i_xattr_nid; /* node id that contains xattrs */ | 340 | nid_t i_xattr_nid; /* node id that contains xattrs */ |
310 | unsigned long long xattr_ver; /* cp version of xattr modification */ | 341 | unsigned long long xattr_ver; /* cp version of xattr modification */ |
311 | struct extent_info ext; /* in-memory extent cache entry */ | 342 | struct extent_info ext; /* in-memory extent cache entry */ |
343 | rwlock_t ext_lock; /* rwlock for single extent cache */ | ||
312 | struct inode_entry *dirty_dir; /* the pointer of dirty dir */ | 344 | struct inode_entry *dirty_dir; /* the pointer of dirty dir */ |
313 | 345 | ||
314 | struct radix_tree_root inmem_root; /* radix tree for inmem pages */ | 346 | struct radix_tree_root inmem_root; /* radix tree for inmem pages */ |
@@ -319,21 +351,51 @@ struct f2fs_inode_info { | |||
319 | static inline void get_extent_info(struct extent_info *ext, | 351 | static inline void get_extent_info(struct extent_info *ext, |
320 | struct f2fs_extent i_ext) | 352 | struct f2fs_extent i_ext) |
321 | { | 353 | { |
322 | write_lock(&ext->ext_lock); | ||
323 | ext->fofs = le32_to_cpu(i_ext.fofs); | 354 | ext->fofs = le32_to_cpu(i_ext.fofs); |
324 | ext->blk_addr = le32_to_cpu(i_ext.blk_addr); | 355 | ext->blk = le32_to_cpu(i_ext.blk); |
325 | ext->len = le32_to_cpu(i_ext.len); | 356 | ext->len = le32_to_cpu(i_ext.len); |
326 | write_unlock(&ext->ext_lock); | ||
327 | } | 357 | } |
328 | 358 | ||
329 | static inline void set_raw_extent(struct extent_info *ext, | 359 | static inline void set_raw_extent(struct extent_info *ext, |
330 | struct f2fs_extent *i_ext) | 360 | struct f2fs_extent *i_ext) |
331 | { | 361 | { |
332 | read_lock(&ext->ext_lock); | ||
333 | i_ext->fofs = cpu_to_le32(ext->fofs); | 362 | i_ext->fofs = cpu_to_le32(ext->fofs); |
334 | i_ext->blk_addr = cpu_to_le32(ext->blk_addr); | 363 | i_ext->blk = cpu_to_le32(ext->blk); |
335 | i_ext->len = cpu_to_le32(ext->len); | 364 | i_ext->len = cpu_to_le32(ext->len); |
336 | read_unlock(&ext->ext_lock); | 365 | } |
366 | |||
367 | static inline void set_extent_info(struct extent_info *ei, unsigned int fofs, | ||
368 | u32 blk, unsigned int len) | ||
369 | { | ||
370 | ei->fofs = fofs; | ||
371 | ei->blk = blk; | ||
372 | ei->len = len; | ||
373 | } | ||
374 | |||
375 | static inline bool __is_extent_same(struct extent_info *ei1, | ||
376 | struct extent_info *ei2) | ||
377 | { | ||
378 | return (ei1->fofs == ei2->fofs && ei1->blk == ei2->blk && | ||
379 | ei1->len == ei2->len); | ||
380 | } | ||
381 | |||
382 | static inline bool __is_extent_mergeable(struct extent_info *back, | ||
383 | struct extent_info *front) | ||
384 | { | ||
385 | return (back->fofs + back->len == front->fofs && | ||
386 | back->blk + back->len == front->blk); | ||
387 | } | ||
388 | |||
389 | static inline bool __is_back_mergeable(struct extent_info *cur, | ||
390 | struct extent_info *back) | ||
391 | { | ||
392 | return __is_extent_mergeable(back, cur); | ||
393 | } | ||
394 | |||
395 | static inline bool __is_front_mergeable(struct extent_info *cur, | ||
396 | struct extent_info *front) | ||
397 | { | ||
398 | return __is_extent_mergeable(cur, front); | ||
337 | } | 399 | } |
338 | 400 | ||
339 | struct f2fs_nm_info { | 401 | struct f2fs_nm_info { |
@@ -502,6 +564,10 @@ enum page_type { | |||
502 | META, | 564 | META, |
503 | NR_PAGE_TYPE, | 565 | NR_PAGE_TYPE, |
504 | META_FLUSH, | 566 | META_FLUSH, |
567 | INMEM, /* the below types are used by tracepoints only. */ | ||
568 | INMEM_DROP, | ||
569 | IPU, | ||
570 | OPU, | ||
505 | }; | 571 | }; |
506 | 572 | ||
507 | struct f2fs_io_info { | 573 | struct f2fs_io_info { |
@@ -559,7 +625,6 @@ struct f2fs_sb_info { | |||
559 | struct mutex cp_mutex; /* checkpoint procedure lock */ | 625 | struct mutex cp_mutex; /* checkpoint procedure lock */ |
560 | struct rw_semaphore cp_rwsem; /* blocking FS operations */ | 626 | struct rw_semaphore cp_rwsem; /* blocking FS operations */ |
561 | struct rw_semaphore node_write; /* locking node writes */ | 627 | struct rw_semaphore node_write; /* locking node writes */ |
562 | struct mutex writepages; /* mutex for writepages() */ | ||
563 | wait_queue_head_t cp_wait; | 628 | wait_queue_head_t cp_wait; |
564 | 629 | ||
565 | struct inode_management im[MAX_INO_ENTRY]; /* manage inode cache */ | 630 | struct inode_management im[MAX_INO_ENTRY]; /* manage inode cache */ |
@@ -571,6 +636,14 @@ struct f2fs_sb_info { | |||
571 | struct list_head dir_inode_list; /* dir inode list */ | 636 | struct list_head dir_inode_list; /* dir inode list */ |
572 | spinlock_t dir_inode_lock; /* for dir inode list lock */ | 637 | spinlock_t dir_inode_lock; /* for dir inode list lock */ |
573 | 638 | ||
639 | /* for extent tree cache */ | ||
640 | struct radix_tree_root extent_tree_root;/* cache extent cache entries */ | ||
641 | struct rw_semaphore extent_tree_lock; /* locking extent radix tree */ | ||
642 | struct list_head extent_list; /* lru list for shrinker */ | ||
643 | spinlock_t extent_lock; /* locking extent lru list */ | ||
644 | int total_ext_tree; /* extent tree count */ | ||
645 | atomic_t total_ext_node; /* extent info count */ | ||
646 | |||
574 | /* basic filesystem units */ | 647 | /* basic filesystem units */ |
575 | unsigned int log_sectors_per_block; /* log2 sectors per block */ | 648 | unsigned int log_sectors_per_block; /* log2 sectors per block */ |
576 | unsigned int log_blocksize; /* log2 block size */ | 649 | unsigned int log_blocksize; /* log2 block size */ |
@@ -920,12 +993,17 @@ static inline unsigned long __bitmap_size(struct f2fs_sb_info *sbi, int flag) | |||
920 | return 0; | 993 | return 0; |
921 | } | 994 | } |
922 | 995 | ||
996 | static inline block_t __cp_payload(struct f2fs_sb_info *sbi) | ||
997 | { | ||
998 | return le32_to_cpu(F2FS_RAW_SUPER(sbi)->cp_payload); | ||
999 | } | ||
1000 | |||
923 | static inline void *__bitmap_ptr(struct f2fs_sb_info *sbi, int flag) | 1001 | static inline void *__bitmap_ptr(struct f2fs_sb_info *sbi, int flag) |
924 | { | 1002 | { |
925 | struct f2fs_checkpoint *ckpt = F2FS_CKPT(sbi); | 1003 | struct f2fs_checkpoint *ckpt = F2FS_CKPT(sbi); |
926 | int offset; | 1004 | int offset; |
927 | 1005 | ||
928 | if (le32_to_cpu(F2FS_RAW_SUPER(sbi)->cp_payload) > 0) { | 1006 | if (__cp_payload(sbi) > 0) { |
929 | if (flag == NAT_BITMAP) | 1007 | if (flag == NAT_BITMAP) |
930 | return &ckpt->sit_nat_version_bitmap; | 1008 | return &ckpt->sit_nat_version_bitmap; |
931 | else | 1009 | else |
@@ -1166,8 +1244,10 @@ enum { | |||
1166 | FI_NEED_IPU, /* used for ipu per file */ | 1244 | FI_NEED_IPU, /* used for ipu per file */ |
1167 | FI_ATOMIC_FILE, /* indicate atomic file */ | 1245 | FI_ATOMIC_FILE, /* indicate atomic file */ |
1168 | FI_VOLATILE_FILE, /* indicate volatile file */ | 1246 | FI_VOLATILE_FILE, /* indicate volatile file */ |
1247 | FI_FIRST_BLOCK_WRITTEN, /* indicate #0 data block was written */ | ||
1169 | FI_DROP_CACHE, /* drop dirty page cache */ | 1248 | FI_DROP_CACHE, /* drop dirty page cache */ |
1170 | FI_DATA_EXIST, /* indicate data exists */ | 1249 | FI_DATA_EXIST, /* indicate data exists */ |
1250 | FI_INLINE_DOTS, /* indicate inline dot dentries */ | ||
1171 | }; | 1251 | }; |
1172 | 1252 | ||
1173 | static inline void set_inode_flag(struct f2fs_inode_info *fi, int flag) | 1253 | static inline void set_inode_flag(struct f2fs_inode_info *fi, int flag) |
@@ -1204,6 +1284,8 @@ static inline void get_inline_info(struct f2fs_inode_info *fi, | |||
1204 | set_inode_flag(fi, FI_INLINE_DENTRY); | 1284 | set_inode_flag(fi, FI_INLINE_DENTRY); |
1205 | if (ri->i_inline & F2FS_DATA_EXIST) | 1285 | if (ri->i_inline & F2FS_DATA_EXIST) |
1206 | set_inode_flag(fi, FI_DATA_EXIST); | 1286 | set_inode_flag(fi, FI_DATA_EXIST); |
1287 | if (ri->i_inline & F2FS_INLINE_DOTS) | ||
1288 | set_inode_flag(fi, FI_INLINE_DOTS); | ||
1207 | } | 1289 | } |
1208 | 1290 | ||
1209 | static inline void set_raw_inline(struct f2fs_inode_info *fi, | 1291 | static inline void set_raw_inline(struct f2fs_inode_info *fi, |
@@ -1219,6 +1301,8 @@ static inline void set_raw_inline(struct f2fs_inode_info *fi, | |||
1219 | ri->i_inline |= F2FS_INLINE_DENTRY; | 1301 | ri->i_inline |= F2FS_INLINE_DENTRY; |
1220 | if (is_inode_flag_set(fi, FI_DATA_EXIST)) | 1302 | if (is_inode_flag_set(fi, FI_DATA_EXIST)) |
1221 | ri->i_inline |= F2FS_DATA_EXIST; | 1303 | ri->i_inline |= F2FS_DATA_EXIST; |
1304 | if (is_inode_flag_set(fi, FI_INLINE_DOTS)) | ||
1305 | ri->i_inline |= F2FS_INLINE_DOTS; | ||
1222 | } | 1306 | } |
1223 | 1307 | ||
1224 | static inline int f2fs_has_inline_xattr(struct inode *inode) | 1308 | static inline int f2fs_has_inline_xattr(struct inode *inode) |
@@ -1264,6 +1348,11 @@ static inline int f2fs_exist_data(struct inode *inode) | |||
1264 | return is_inode_flag_set(F2FS_I(inode), FI_DATA_EXIST); | 1348 | return is_inode_flag_set(F2FS_I(inode), FI_DATA_EXIST); |
1265 | } | 1349 | } |
1266 | 1350 | ||
1351 | static inline int f2fs_has_inline_dots(struct inode *inode) | ||
1352 | { | ||
1353 | return is_inode_flag_set(F2FS_I(inode), FI_INLINE_DOTS); | ||
1354 | } | ||
1355 | |||
1267 | static inline bool f2fs_is_atomic_file(struct inode *inode) | 1356 | static inline bool f2fs_is_atomic_file(struct inode *inode) |
1268 | { | 1357 | { |
1269 | return is_inode_flag_set(F2FS_I(inode), FI_ATOMIC_FILE); | 1358 | return is_inode_flag_set(F2FS_I(inode), FI_ATOMIC_FILE); |
@@ -1274,6 +1363,11 @@ static inline bool f2fs_is_volatile_file(struct inode *inode) | |||
1274 | return is_inode_flag_set(F2FS_I(inode), FI_VOLATILE_FILE); | 1363 | return is_inode_flag_set(F2FS_I(inode), FI_VOLATILE_FILE); |
1275 | } | 1364 | } |
1276 | 1365 | ||
1366 | static inline bool f2fs_is_first_block_written(struct inode *inode) | ||
1367 | { | ||
1368 | return is_inode_flag_set(F2FS_I(inode), FI_FIRST_BLOCK_WRITTEN); | ||
1369 | } | ||
1370 | |||
1277 | static inline bool f2fs_is_drop_cache(struct inode *inode) | 1371 | static inline bool f2fs_is_drop_cache(struct inode *inode) |
1278 | { | 1372 | { |
1279 | return is_inode_flag_set(F2FS_I(inode), FI_DROP_CACHE); | 1373 | return is_inode_flag_set(F2FS_I(inode), FI_DROP_CACHE); |
@@ -1290,12 +1384,6 @@ static inline int f2fs_has_inline_dentry(struct inode *inode) | |||
1290 | return is_inode_flag_set(F2FS_I(inode), FI_INLINE_DENTRY); | 1384 | return is_inode_flag_set(F2FS_I(inode), FI_INLINE_DENTRY); |
1291 | } | 1385 | } |
1292 | 1386 | ||
1293 | static inline void *inline_dentry_addr(struct page *page) | ||
1294 | { | ||
1295 | struct f2fs_inode *ri = F2FS_INODE(page); | ||
1296 | return (void *)&(ri->i_addr[1]); | ||
1297 | } | ||
1298 | |||
1299 | static inline void f2fs_dentry_kunmap(struct inode *dir, struct page *page) | 1387 | static inline void f2fs_dentry_kunmap(struct inode *dir, struct page *page) |
1300 | { | 1388 | { |
1301 | if (!f2fs_has_inline_dentry(dir)) | 1389 | if (!f2fs_has_inline_dentry(dir)) |
@@ -1363,7 +1451,7 @@ struct dentry *f2fs_get_parent(struct dentry *child); | |||
1363 | * dir.c | 1451 | * dir.c |
1364 | */ | 1452 | */ |
1365 | extern unsigned char f2fs_filetype_table[F2FS_FT_MAX]; | 1453 | extern unsigned char f2fs_filetype_table[F2FS_FT_MAX]; |
1366 | void set_de_type(struct f2fs_dir_entry *, struct inode *); | 1454 | void set_de_type(struct f2fs_dir_entry *, umode_t); |
1367 | struct f2fs_dir_entry *find_target_dentry(struct qstr *, int *, | 1455 | struct f2fs_dir_entry *find_target_dentry(struct qstr *, int *, |
1368 | struct f2fs_dentry_ptr *); | 1456 | struct f2fs_dentry_ptr *); |
1369 | bool f2fs_fill_dentries(struct dir_context *, struct f2fs_dentry_ptr *, | 1457 | bool f2fs_fill_dentries(struct dir_context *, struct f2fs_dentry_ptr *, |
@@ -1382,7 +1470,10 @@ ino_t f2fs_inode_by_name(struct inode *, struct qstr *); | |||
1382 | void f2fs_set_link(struct inode *, struct f2fs_dir_entry *, | 1470 | void f2fs_set_link(struct inode *, struct f2fs_dir_entry *, |
1383 | struct page *, struct inode *); | 1471 | struct page *, struct inode *); |
1384 | int update_dent_inode(struct inode *, const struct qstr *); | 1472 | int update_dent_inode(struct inode *, const struct qstr *); |
1385 | int __f2fs_add_link(struct inode *, const struct qstr *, struct inode *); | 1473 | void f2fs_update_dentry(nid_t ino, umode_t mode, struct f2fs_dentry_ptr *, |
1474 | const struct qstr *, f2fs_hash_t , unsigned int); | ||
1475 | int __f2fs_add_link(struct inode *, const struct qstr *, struct inode *, nid_t, | ||
1476 | umode_t); | ||
1386 | void f2fs_delete_entry(struct f2fs_dir_entry *, struct page *, struct inode *, | 1477 | void f2fs_delete_entry(struct f2fs_dir_entry *, struct page *, struct inode *, |
1387 | struct inode *); | 1478 | struct inode *); |
1388 | int f2fs_do_tmpfile(struct inode *, struct inode *); | 1479 | int f2fs_do_tmpfile(struct inode *, struct inode *); |
@@ -1392,7 +1483,7 @@ bool f2fs_empty_dir(struct inode *); | |||
1392 | static inline int f2fs_add_link(struct dentry *dentry, struct inode *inode) | 1483 | static inline int f2fs_add_link(struct dentry *dentry, struct inode *inode) |
1393 | { | 1484 | { |
1394 | return __f2fs_add_link(dentry->d_parent->d_inode, &dentry->d_name, | 1485 | return __f2fs_add_link(dentry->d_parent->d_inode, &dentry->d_name, |
1395 | inode); | 1486 | inode, inode->i_ino, inode->i_mode); |
1396 | } | 1487 | } |
1397 | 1488 | ||
1398 | /* | 1489 | /* |
@@ -1519,14 +1610,22 @@ int f2fs_submit_page_bio(struct f2fs_sb_info *, struct page *, | |||
1519 | struct f2fs_io_info *); | 1610 | struct f2fs_io_info *); |
1520 | void f2fs_submit_page_mbio(struct f2fs_sb_info *, struct page *, | 1611 | void f2fs_submit_page_mbio(struct f2fs_sb_info *, struct page *, |
1521 | struct f2fs_io_info *); | 1612 | struct f2fs_io_info *); |
1613 | void set_data_blkaddr(struct dnode_of_data *); | ||
1522 | int reserve_new_block(struct dnode_of_data *); | 1614 | int reserve_new_block(struct dnode_of_data *); |
1523 | int f2fs_reserve_block(struct dnode_of_data *, pgoff_t); | 1615 | int f2fs_reserve_block(struct dnode_of_data *, pgoff_t); |
1524 | void update_extent_cache(struct dnode_of_data *); | 1616 | void f2fs_shrink_extent_tree(struct f2fs_sb_info *, int); |
1617 | void f2fs_destroy_extent_tree(struct inode *); | ||
1618 | void f2fs_init_extent_cache(struct inode *, struct f2fs_extent *); | ||
1619 | void f2fs_update_extent_cache(struct dnode_of_data *); | ||
1620 | void f2fs_preserve_extent_tree(struct inode *); | ||
1525 | struct page *find_data_page(struct inode *, pgoff_t, bool); | 1621 | struct page *find_data_page(struct inode *, pgoff_t, bool); |
1526 | struct page *get_lock_data_page(struct inode *, pgoff_t); | 1622 | struct page *get_lock_data_page(struct inode *, pgoff_t); |
1527 | struct page *get_new_data_page(struct inode *, struct page *, pgoff_t, bool); | 1623 | struct page *get_new_data_page(struct inode *, struct page *, pgoff_t, bool); |
1528 | int do_write_data_page(struct page *, struct f2fs_io_info *); | 1624 | int do_write_data_page(struct page *, struct f2fs_io_info *); |
1529 | int f2fs_fiemap(struct inode *inode, struct fiemap_extent_info *, u64, u64); | 1625 | int f2fs_fiemap(struct inode *inode, struct fiemap_extent_info *, u64, u64); |
1626 | void init_extent_cache_info(struct f2fs_sb_info *); | ||
1627 | int __init create_extent_cache(void); | ||
1628 | void destroy_extent_cache(void); | ||
1530 | void f2fs_invalidate_page(struct page *, unsigned int, unsigned int); | 1629 | void f2fs_invalidate_page(struct page *, unsigned int, unsigned int); |
1531 | int f2fs_release_page(struct page *, gfp_t); | 1630 | int f2fs_release_page(struct page *, gfp_t); |
1532 | 1631 | ||
@@ -1554,7 +1653,7 @@ struct f2fs_stat_info { | |||
1554 | struct f2fs_sb_info *sbi; | 1653 | struct f2fs_sb_info *sbi; |
1555 | int all_area_segs, sit_area_segs, nat_area_segs, ssa_area_segs; | 1654 | int all_area_segs, sit_area_segs, nat_area_segs, ssa_area_segs; |
1556 | int main_area_segs, main_area_sections, main_area_zones; | 1655 | int main_area_segs, main_area_sections, main_area_zones; |
1557 | int hit_ext, total_ext; | 1656 | int hit_ext, total_ext, ext_tree, ext_node; |
1558 | int ndirty_node, ndirty_dent, ndirty_dirs, ndirty_meta; | 1657 | int ndirty_node, ndirty_dent, ndirty_dirs, ndirty_meta; |
1559 | int nats, dirty_nats, sits, dirty_sits, fnids; | 1658 | int nats, dirty_nats, sits, dirty_sits, fnids; |
1560 | int total_count, utilization; | 1659 | int total_count, utilization; |
@@ -1566,7 +1665,9 @@ struct f2fs_stat_info { | |||
1566 | int dirty_count, node_pages, meta_pages; | 1665 | int dirty_count, node_pages, meta_pages; |
1567 | int prefree_count, call_count, cp_count; | 1666 | int prefree_count, call_count, cp_count; |
1568 | int tot_segs, node_segs, data_segs, free_segs, free_secs; | 1667 | int tot_segs, node_segs, data_segs, free_segs, free_secs; |
1668 | int bg_node_segs, bg_data_segs; | ||
1569 | int tot_blks, data_blks, node_blks; | 1669 | int tot_blks, data_blks, node_blks; |
1670 | int bg_data_blks, bg_node_blks; | ||
1570 | int curseg[NR_CURSEG_TYPE]; | 1671 | int curseg[NR_CURSEG_TYPE]; |
1571 | int cursec[NR_CURSEG_TYPE]; | 1672 | int cursec[NR_CURSEG_TYPE]; |
1572 | int curzone[NR_CURSEG_TYPE]; | 1673 | int curzone[NR_CURSEG_TYPE]; |
@@ -1615,31 +1716,36 @@ static inline struct f2fs_stat_info *F2FS_STAT(struct f2fs_sb_info *sbi) | |||
1615 | ((sbi)->block_count[(curseg)->alloc_type]++) | 1716 | ((sbi)->block_count[(curseg)->alloc_type]++) |
1616 | #define stat_inc_inplace_blocks(sbi) \ | 1717 | #define stat_inc_inplace_blocks(sbi) \ |
1617 | (atomic_inc(&(sbi)->inplace_count)) | 1718 | (atomic_inc(&(sbi)->inplace_count)) |
1618 | #define stat_inc_seg_count(sbi, type) \ | 1719 | #define stat_inc_seg_count(sbi, type, gc_type) \ |
1619 | do { \ | 1720 | do { \ |
1620 | struct f2fs_stat_info *si = F2FS_STAT(sbi); \ | 1721 | struct f2fs_stat_info *si = F2FS_STAT(sbi); \ |
1621 | (si)->tot_segs++; \ | 1722 | (si)->tot_segs++; \ |
1622 | if (type == SUM_TYPE_DATA) \ | 1723 | if (type == SUM_TYPE_DATA) { \ |
1623 | si->data_segs++; \ | 1724 | si->data_segs++; \ |
1624 | else \ | 1725 | si->bg_data_segs += (gc_type == BG_GC) ? 1 : 0; \ |
1726 | } else { \ | ||
1625 | si->node_segs++; \ | 1727 | si->node_segs++; \ |
1728 | si->bg_node_segs += (gc_type == BG_GC) ? 1 : 0; \ | ||
1729 | } \ | ||
1626 | } while (0) | 1730 | } while (0) |
1627 | 1731 | ||
1628 | #define stat_inc_tot_blk_count(si, blks) \ | 1732 | #define stat_inc_tot_blk_count(si, blks) \ |
1629 | (si->tot_blks += (blks)) | 1733 | (si->tot_blks += (blks)) |
1630 | 1734 | ||
1631 | #define stat_inc_data_blk_count(sbi, blks) \ | 1735 | #define stat_inc_data_blk_count(sbi, blks, gc_type) \ |
1632 | do { \ | 1736 | do { \ |
1633 | struct f2fs_stat_info *si = F2FS_STAT(sbi); \ | 1737 | struct f2fs_stat_info *si = F2FS_STAT(sbi); \ |
1634 | stat_inc_tot_blk_count(si, blks); \ | 1738 | stat_inc_tot_blk_count(si, blks); \ |
1635 | si->data_blks += (blks); \ | 1739 | si->data_blks += (blks); \ |
1740 | si->bg_data_blks += (gc_type == BG_GC) ? (blks) : 0; \ | ||
1636 | } while (0) | 1741 | } while (0) |
1637 | 1742 | ||
1638 | #define stat_inc_node_blk_count(sbi, blks) \ | 1743 | #define stat_inc_node_blk_count(sbi, blks, gc_type) \ |
1639 | do { \ | 1744 | do { \ |
1640 | struct f2fs_stat_info *si = F2FS_STAT(sbi); \ | 1745 | struct f2fs_stat_info *si = F2FS_STAT(sbi); \ |
1641 | stat_inc_tot_blk_count(si, blks); \ | 1746 | stat_inc_tot_blk_count(si, blks); \ |
1642 | si->node_blks += (blks); \ | 1747 | si->node_blks += (blks); \ |
1748 | si->bg_node_blks += (gc_type == BG_GC) ? (blks) : 0; \ | ||
1643 | } while (0) | 1749 | } while (0) |
1644 | 1750 | ||
1645 | int f2fs_build_stats(struct f2fs_sb_info *); | 1751 | int f2fs_build_stats(struct f2fs_sb_info *); |
@@ -1661,10 +1767,10 @@ void f2fs_destroy_root_stats(void); | |||
1661 | #define stat_inc_seg_type(sbi, curseg) | 1767 | #define stat_inc_seg_type(sbi, curseg) |
1662 | #define stat_inc_block_count(sbi, curseg) | 1768 | #define stat_inc_block_count(sbi, curseg) |
1663 | #define stat_inc_inplace_blocks(sbi) | 1769 | #define stat_inc_inplace_blocks(sbi) |
1664 | #define stat_inc_seg_count(si, type) | 1770 | #define stat_inc_seg_count(sbi, type, gc_type) |
1665 | #define stat_inc_tot_blk_count(si, blks) | 1771 | #define stat_inc_tot_blk_count(si, blks) |
1666 | #define stat_inc_data_blk_count(si, blks) | 1772 | #define stat_inc_data_blk_count(sbi, blks, gc_type) |
1667 | #define stat_inc_node_blk_count(sbi, blks) | 1773 | #define stat_inc_node_blk_count(sbi, blks, gc_type) |
1668 | 1774 | ||
1669 | static inline int f2fs_build_stats(struct f2fs_sb_info *sbi) { return 0; } | 1775 | static inline int f2fs_build_stats(struct f2fs_sb_info *sbi) { return 0; } |
1670 | static inline void f2fs_destroy_stats(struct f2fs_sb_info *sbi) { } | 1776 | static inline void f2fs_destroy_stats(struct f2fs_sb_info *sbi) { } |
@@ -1688,6 +1794,7 @@ extern struct kmem_cache *inode_entry_slab; | |||
1688 | */ | 1794 | */ |
1689 | bool f2fs_may_inline(struct inode *); | 1795 | bool f2fs_may_inline(struct inode *); |
1690 | void read_inline_data(struct page *, struct page *); | 1796 | void read_inline_data(struct page *, struct page *); |
1797 | bool truncate_inline_inode(struct page *, u64); | ||
1691 | int f2fs_read_inline_data(struct inode *, struct page *); | 1798 | int f2fs_read_inline_data(struct inode *, struct page *); |
1692 | int f2fs_convert_inline_page(struct dnode_of_data *, struct page *); | 1799 | int f2fs_convert_inline_page(struct dnode_of_data *, struct page *); |
1693 | int f2fs_convert_inline_inode(struct inode *); | 1800 | int f2fs_convert_inline_inode(struct inode *); |
@@ -1697,7 +1804,8 @@ struct f2fs_dir_entry *find_in_inline_dir(struct inode *, struct qstr *, | |||
1697 | struct page **); | 1804 | struct page **); |
1698 | struct f2fs_dir_entry *f2fs_parent_inline_dir(struct inode *, struct page **); | 1805 | struct f2fs_dir_entry *f2fs_parent_inline_dir(struct inode *, struct page **); |
1699 | int make_empty_inline_dir(struct inode *inode, struct inode *, struct page *); | 1806 | int make_empty_inline_dir(struct inode *inode, struct inode *, struct page *); |
1700 | int f2fs_add_inline_entry(struct inode *, const struct qstr *, struct inode *); | 1807 | int f2fs_add_inline_entry(struct inode *, const struct qstr *, struct inode *, |
1808 | nid_t, umode_t); | ||
1701 | void f2fs_delete_inline_entry(struct f2fs_dir_entry *, struct page *, | 1809 | void f2fs_delete_inline_entry(struct f2fs_dir_entry *, struct page *, |
1702 | struct inode *, struct inode *); | 1810 | struct inode *, struct inode *); |
1703 | bool f2fs_empty_inline_dir(struct inode *); | 1811 | bool f2fs_empty_inline_dir(struct inode *); |