f2fs.h (9ac1e2d88d076aa1ae9e33d44a9bbc8ae3bfa791) f2fs.h (1ad71a27124caf0b68ddd3c92be01aa2b2a72b2a)
1/*
2 * fs/f2fs/f2fs.h
3 *
4 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com/
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as

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

351 struct f2fs_defragment)
352#define F2FS_IOC_MOVE_RANGE _IOWR(F2FS_IOCTL_MAGIC, 9, \
353 struct f2fs_move_range)
354#define F2FS_IOC_FLUSH_DEVICE _IOW(F2FS_IOCTL_MAGIC, 10, \
355 struct f2fs_flush_device)
356#define F2FS_IOC_GARBAGE_COLLECT_RANGE _IOW(F2FS_IOCTL_MAGIC, 11, \
357 struct f2fs_gc_range)
358#define F2FS_IOC_GET_FEATURES _IOR(F2FS_IOCTL_MAGIC, 12, __u32)
1/*
2 * fs/f2fs/f2fs.h
3 *
4 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com/
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as

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

351 struct f2fs_defragment)
352#define F2FS_IOC_MOVE_RANGE _IOWR(F2FS_IOCTL_MAGIC, 9, \
353 struct f2fs_move_range)
354#define F2FS_IOC_FLUSH_DEVICE _IOW(F2FS_IOCTL_MAGIC, 10, \
355 struct f2fs_flush_device)
356#define F2FS_IOC_GARBAGE_COLLECT_RANGE _IOW(F2FS_IOCTL_MAGIC, 11, \
357 struct f2fs_gc_range)
358#define F2FS_IOC_GET_FEATURES _IOR(F2FS_IOCTL_MAGIC, 12, __u32)
359#define F2FS_IOC_SET_PIN_FILE _IOW(F2FS_IOCTL_MAGIC, 13, __u32)
360#define F2FS_IOC_GET_PIN_FILE _IOR(F2FS_IOCTL_MAGIC, 14, __u32)
359
360#define F2FS_IOC_SET_ENCRYPTION_POLICY FS_IOC_SET_ENCRYPTION_POLICY
361#define F2FS_IOC_GET_ENCRYPTION_POLICY FS_IOC_GET_ENCRYPTION_POLICY
362#define F2FS_IOC_GET_ENCRYPTION_PWSALT FS_IOC_GET_ENCRYPTION_PWSALT
363
364/*
365 * should be same as XFS_IOC_GOINGDOWN.
366 * Flags for going down operation used by FS_IOC_GOINGDOWN

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

588
589#define DEF_DIR_LEVEL 0
590
591struct f2fs_inode_info {
592 struct inode vfs_inode; /* serve a vfs inode */
593 unsigned long i_flags; /* keep an inode flags for ioctl */
594 unsigned char i_advise; /* use to give file attribute hints */
595 unsigned char i_dir_level; /* use for dentry level for large dir */
361
362#define F2FS_IOC_SET_ENCRYPTION_POLICY FS_IOC_SET_ENCRYPTION_POLICY
363#define F2FS_IOC_GET_ENCRYPTION_POLICY FS_IOC_GET_ENCRYPTION_POLICY
364#define F2FS_IOC_GET_ENCRYPTION_PWSALT FS_IOC_GET_ENCRYPTION_PWSALT
365
366/*
367 * should be same as XFS_IOC_GOINGDOWN.
368 * Flags for going down operation used by FS_IOC_GOINGDOWN

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

590
591#define DEF_DIR_LEVEL 0
592
593struct f2fs_inode_info {
594 struct inode vfs_inode; /* serve a vfs inode */
595 unsigned long i_flags; /* keep an inode flags for ioctl */
596 unsigned char i_advise; /* use to give file attribute hints */
597 unsigned char i_dir_level; /* use for dentry level for large dir */
596 unsigned int i_current_depth; /* use only in directory structure */
598 union {
599 unsigned int i_current_depth; /* only for directory depth */
600 unsigned short i_gc_failures; /* only for regular file */
601 };
597 unsigned int i_pino; /* parent inode number */
598 umode_t i_acl_mode; /* keep file acl mode temporarily */
599
600 /* Use below internally in f2fs*/
601 unsigned long flags; /* use to pass per-file flags */
602 struct rw_semaphore i_sem; /* protect fi info */
603 atomic_t dirty_pages; /* # of dirty pages */
604 f2fs_hash_t chash; /* hash value of given file name */

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

1137 /* for cleaning operations */
1138 struct mutex gc_mutex; /* mutex for GC */
1139 struct f2fs_gc_kthread *gc_thread; /* GC thread */
1140 unsigned int cur_victim_sec; /* current victim section num */
1141
1142 /* threshold for converting bg victims for fg */
1143 u64 fggc_threshold;
1144
602 unsigned int i_pino; /* parent inode number */
603 umode_t i_acl_mode; /* keep file acl mode temporarily */
604
605 /* Use below internally in f2fs*/
606 unsigned long flags; /* use to pass per-file flags */
607 struct rw_semaphore i_sem; /* protect fi info */
608 atomic_t dirty_pages; /* # of dirty pages */
609 f2fs_hash_t chash; /* hash value of given file name */

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

1142 /* for cleaning operations */
1143 struct mutex gc_mutex; /* mutex for GC */
1144 struct f2fs_gc_kthread *gc_thread; /* GC thread */
1145 unsigned int cur_victim_sec; /* current victim section num */
1146
1147 /* threshold for converting bg victims for fg */
1148 u64 fggc_threshold;
1149
1150 /* threshold for gc trials on pinned files */
1151 u64 gc_pin_file_threshold;
1152
1145 /* maximum # of trials to find a victim segment for SSR and GC */
1146 unsigned int max_victim_search;
1147
1148 /*
1149 * for stat information.
1150 * one is for the LFS mode, and the other is for the SSR mode.
1151 */
1152#ifdef CONFIG_F2FS_STAT_FS

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

2136 FI_DATA_EXIST, /* indicate data exists */
2137 FI_INLINE_DOTS, /* indicate inline dot dentries */
2138 FI_DO_DEFRAG, /* indicate defragment is running */
2139 FI_DIRTY_FILE, /* indicate regular/symlink has dirty pages */
2140 FI_NO_PREALLOC, /* indicate skipped preallocated blocks */
2141 FI_HOT_DATA, /* indicate file is hot */
2142 FI_EXTRA_ATTR, /* indicate file has extra attribute */
2143 FI_PROJ_INHERIT, /* indicate file inherits projectid */
1153 /* maximum # of trials to find a victim segment for SSR and GC */
1154 unsigned int max_victim_search;
1155
1156 /*
1157 * for stat information.
1158 * one is for the LFS mode, and the other is for the SSR mode.
1159 */
1160#ifdef CONFIG_F2FS_STAT_FS

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

2144 FI_DATA_EXIST, /* indicate data exists */
2145 FI_INLINE_DOTS, /* indicate inline dot dentries */
2146 FI_DO_DEFRAG, /* indicate defragment is running */
2147 FI_DIRTY_FILE, /* indicate regular/symlink has dirty pages */
2148 FI_NO_PREALLOC, /* indicate skipped preallocated blocks */
2149 FI_HOT_DATA, /* indicate file is hot */
2150 FI_EXTRA_ATTR, /* indicate file has extra attribute */
2151 FI_PROJ_INHERIT, /* indicate file inherits projectid */
2152 FI_PIN_FILE, /* indicate file should not be gced */
2144};
2145
2146static inline void __mark_inode_dirty_flag(struct inode *inode,
2147 int flag, bool set)
2148{
2149 switch (flag) {
2150 case FI_INLINE_XATTR:
2151 case FI_INLINE_DATA:
2152 case FI_INLINE_DENTRY:
2153 case FI_NEW_INODE:
2154 if (set)
2155 return;
2156 case FI_DATA_EXIST:
2157 case FI_INLINE_DOTS:
2153};
2154
2155static inline void __mark_inode_dirty_flag(struct inode *inode,
2156 int flag, bool set)
2157{
2158 switch (flag) {
2159 case FI_INLINE_XATTR:
2160 case FI_INLINE_DATA:
2161 case FI_INLINE_DENTRY:
2162 case FI_NEW_INODE:
2163 if (set)
2164 return;
2165 case FI_DATA_EXIST:
2166 case FI_INLINE_DOTS:
2167 case FI_PIN_FILE:
2158 f2fs_mark_inode_dirty_sync(inode, true);
2159 }
2160}
2161
2162static inline void set_inode_flag(struct inode *inode, int flag)
2163{
2164 if (!test_bit(flag, &F2FS_I(inode)->flags))
2165 set_bit(flag, &F2FS_I(inode)->flags);

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

2230}
2231
2232static inline void f2fs_i_depth_write(struct inode *inode, unsigned int depth)
2233{
2234 F2FS_I(inode)->i_current_depth = depth;
2235 f2fs_mark_inode_dirty_sync(inode, true);
2236}
2237
2168 f2fs_mark_inode_dirty_sync(inode, true);
2169 }
2170}
2171
2172static inline void set_inode_flag(struct inode *inode, int flag)
2173{
2174 if (!test_bit(flag, &F2FS_I(inode)->flags))
2175 set_bit(flag, &F2FS_I(inode)->flags);

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

2240}
2241
2242static inline void f2fs_i_depth_write(struct inode *inode, unsigned int depth)
2243{
2244 F2FS_I(inode)->i_current_depth = depth;
2245 f2fs_mark_inode_dirty_sync(inode, true);
2246}
2247
2248static inline void f2fs_i_gc_failures_write(struct inode *inode,
2249 unsigned int count)
2250{
2251 F2FS_I(inode)->i_gc_failures = count;
2252 f2fs_mark_inode_dirty_sync(inode, true);
2253}
2254
2238static inline void f2fs_i_xnid_write(struct inode *inode, nid_t xnid)
2239{
2240 F2FS_I(inode)->i_xattr_nid = xnid;
2241 f2fs_mark_inode_dirty_sync(inode, true);
2242}
2243
2244static inline void f2fs_i_pino_write(struct inode *inode, nid_t pino)
2245{

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

2258 if (ri->i_inline & F2FS_INLINE_DENTRY)
2259 set_bit(FI_INLINE_DENTRY, &fi->flags);
2260 if (ri->i_inline & F2FS_DATA_EXIST)
2261 set_bit(FI_DATA_EXIST, &fi->flags);
2262 if (ri->i_inline & F2FS_INLINE_DOTS)
2263 set_bit(FI_INLINE_DOTS, &fi->flags);
2264 if (ri->i_inline & F2FS_EXTRA_ATTR)
2265 set_bit(FI_EXTRA_ATTR, &fi->flags);
2255static inline void f2fs_i_xnid_write(struct inode *inode, nid_t xnid)
2256{
2257 F2FS_I(inode)->i_xattr_nid = xnid;
2258 f2fs_mark_inode_dirty_sync(inode, true);
2259}
2260
2261static inline void f2fs_i_pino_write(struct inode *inode, nid_t pino)
2262{

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

2275 if (ri->i_inline & F2FS_INLINE_DENTRY)
2276 set_bit(FI_INLINE_DENTRY, &fi->flags);
2277 if (ri->i_inline & F2FS_DATA_EXIST)
2278 set_bit(FI_DATA_EXIST, &fi->flags);
2279 if (ri->i_inline & F2FS_INLINE_DOTS)
2280 set_bit(FI_INLINE_DOTS, &fi->flags);
2281 if (ri->i_inline & F2FS_EXTRA_ATTR)
2282 set_bit(FI_EXTRA_ATTR, &fi->flags);
2283 if (ri->i_inline & F2FS_PIN_FILE)
2284 set_bit(FI_PIN_FILE, &fi->flags);
2266}
2267
2268static inline void set_raw_inline(struct inode *inode, struct f2fs_inode *ri)
2269{
2270 ri->i_inline = 0;
2271
2272 if (is_inode_flag_set(inode, FI_INLINE_XATTR))
2273 ri->i_inline |= F2FS_INLINE_XATTR;
2274 if (is_inode_flag_set(inode, FI_INLINE_DATA))
2275 ri->i_inline |= F2FS_INLINE_DATA;
2276 if (is_inode_flag_set(inode, FI_INLINE_DENTRY))
2277 ri->i_inline |= F2FS_INLINE_DENTRY;
2278 if (is_inode_flag_set(inode, FI_DATA_EXIST))
2279 ri->i_inline |= F2FS_DATA_EXIST;
2280 if (is_inode_flag_set(inode, FI_INLINE_DOTS))
2281 ri->i_inline |= F2FS_INLINE_DOTS;
2282 if (is_inode_flag_set(inode, FI_EXTRA_ATTR))
2283 ri->i_inline |= F2FS_EXTRA_ATTR;
2285}
2286
2287static inline void set_raw_inline(struct inode *inode, struct f2fs_inode *ri)
2288{
2289 ri->i_inline = 0;
2290
2291 if (is_inode_flag_set(inode, FI_INLINE_XATTR))
2292 ri->i_inline |= F2FS_INLINE_XATTR;
2293 if (is_inode_flag_set(inode, FI_INLINE_DATA))
2294 ri->i_inline |= F2FS_INLINE_DATA;
2295 if (is_inode_flag_set(inode, FI_INLINE_DENTRY))
2296 ri->i_inline |= F2FS_INLINE_DENTRY;
2297 if (is_inode_flag_set(inode, FI_DATA_EXIST))
2298 ri->i_inline |= F2FS_DATA_EXIST;
2299 if (is_inode_flag_set(inode, FI_INLINE_DOTS))
2300 ri->i_inline |= F2FS_INLINE_DOTS;
2301 if (is_inode_flag_set(inode, FI_EXTRA_ATTR))
2302 ri->i_inline |= F2FS_EXTRA_ATTR;
2303 if (is_inode_flag_set(inode, FI_PIN_FILE))
2304 ri->i_inline |= F2FS_PIN_FILE;
2284}
2285
2286static inline int f2fs_has_extra_attr(struct inode *inode)
2287{
2288 return is_inode_flag_set(inode, FI_EXTRA_ATTR);
2289}
2290
2291static inline int f2fs_has_inline_xattr(struct inode *inode)

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

2321 return is_inode_flag_set(inode, FI_DATA_EXIST);
2322}
2323
2324static inline int f2fs_has_inline_dots(struct inode *inode)
2325{
2326 return is_inode_flag_set(inode, FI_INLINE_DOTS);
2327}
2328
2305}
2306
2307static inline int f2fs_has_extra_attr(struct inode *inode)
2308{
2309 return is_inode_flag_set(inode, FI_EXTRA_ATTR);
2310}
2311
2312static inline int f2fs_has_inline_xattr(struct inode *inode)

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

2342 return is_inode_flag_set(inode, FI_DATA_EXIST);
2343}
2344
2345static inline int f2fs_has_inline_dots(struct inode *inode)
2346{
2347 return is_inode_flag_set(inode, FI_INLINE_DOTS);
2348}
2349
2350static inline bool f2fs_is_pinned_file(struct inode *inode)
2351{
2352 return is_inode_flag_set(inode, FI_PIN_FILE);
2353}
2354
2329static inline bool f2fs_is_atomic_file(struct inode *inode)
2330{
2331 return is_inode_flag_set(inode, FI_ATOMIC_FILE);
2332}
2333
2334static inline bool f2fs_is_commit_atomic_write(struct inode *inode)
2335{
2336 return is_inode_flag_set(inode, FI_ATOMIC_COMMIT);

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

2535int f2fs_truncate(struct inode *inode);
2536int f2fs_getattr(const struct path *path, struct kstat *stat,
2537 u32 request_mask, unsigned int flags);
2538int f2fs_setattr(struct dentry *dentry, struct iattr *attr);
2539int truncate_hole(struct inode *inode, pgoff_t pg_start, pgoff_t pg_end);
2540void truncate_data_blocks_range(struct dnode_of_data *dn, int count);
2541long f2fs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
2542long f2fs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
2355static inline bool f2fs_is_atomic_file(struct inode *inode)
2356{
2357 return is_inode_flag_set(inode, FI_ATOMIC_FILE);
2358}
2359
2360static inline bool f2fs_is_commit_atomic_write(struct inode *inode)
2361{
2362 return is_inode_flag_set(inode, FI_ATOMIC_COMMIT);

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

2561int f2fs_truncate(struct inode *inode);
2562int f2fs_getattr(const struct path *path, struct kstat *stat,
2563 u32 request_mask, unsigned int flags);
2564int f2fs_setattr(struct dentry *dentry, struct iattr *attr);
2565int truncate_hole(struct inode *inode, pgoff_t pg_start, pgoff_t pg_end);
2566void truncate_data_blocks_range(struct dnode_of_data *dn, int count);
2567long f2fs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
2568long f2fs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
2569int f2fs_pin_file_control(struct inode *inode, bool inc);
2543
2544/*
2545 * inode.c
2546 */
2547void f2fs_set_inode_flags(struct inode *inode);
2548bool f2fs_inode_chksum_verify(struct f2fs_sb_info *sbi, struct page *page);
2549void f2fs_inode_chksum_set(struct f2fs_sb_info *sbi, struct page *page);
2550struct inode *f2fs_iget(struct super_block *sb, unsigned long ino);

--- 667 unchanged lines hidden ---
2570
2571/*
2572 * inode.c
2573 */
2574void f2fs_set_inode_flags(struct inode *inode);
2575bool f2fs_inode_chksum_verify(struct f2fs_sb_info *sbi, struct page *page);
2576void f2fs_inode_chksum_set(struct f2fs_sb_info *sbi, struct page *page);
2577struct inode *f2fs_iget(struct super_block *sb, unsigned long ino);

--- 667 unchanged lines hidden ---