summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* f2fs: fix to call put_page at the error handling routineJaegeuk Kim2014-11-181-3/+3
| | | | | | | The locked page should be released before returning the function. Reviewed-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: convert inline_data when i_size becomes largeJaegeuk Kim2014-11-112-0/+9
| | | | | | | | | | If i_size becomes large outside of MAX_INLINE_DATA, we shoud convert the inode. Otherwise, we can make some dirty pages during the truncation, and those pages will be written through f2fs_write_data_page. At that moment, the inode has still inline_data, so that it tries to write non- zero pages into inline_data area. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: fix deadlock to grab 0'th data pageJaegeuk Kim2014-11-111-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | The scenario is like this. One trhead triggers: f2fs_write_data_pages lock_page f2fs_write_data_page f2fs_lock_op <- wait The other thread triggers: f2fs_truncate truncate_blocks f2fs_lock_op truncate_partial_data_page lock_page <- wait for locking the page This patch resolves this bug by relocating truncate_partial_data_page. This function is just to truncate user data page and not related to FS consistency as well. And, we don't need to call truncate_inline_data. Rather than that, f2fs_write_data_page will finally update inline_data later. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: reduce the number of inline_data inode before clearing itJaegeuk Kim2014-11-101-1/+1
| | | | | | | The # of inline_data inode is decreased only when it has inline_data. After clearing the flag, we can't decreased the number. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: implement -o dirsyncJaegeuk Kim2014-11-101-0/+24
| | | | | | | If a mount option has dirsync, we should call checkpoint for all the directory operations. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: do not skip any writes under memory pressureJaegeuk Kim2014-11-101-0/+3
| | | | | | Under memory pressure, let's avoid skipping data writes. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: write node pages if checkpoint is not doingJaegeuk Kim2014-11-101-4/+6
| | | | | | | | It needs to write node pages if checkpoint is not doing in order to avoid memory pressure. Reviewed-by: Changman Lee <cm224.lee@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: control the memory footprint used by ino entriesJaegeuk Kim2014-11-063-8/+26
| | | | | | | This patch adds to control the memory footprint used by ino entries. This will conduct best effort, not strictly. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: introduce the number of inode entriesJaegeuk Kim2014-11-063-14/+19
| | | | | | This patch adds to monitor the number of ino entries. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: disable roll-forward when active_logs = 2Jaegeuk Kim2014-11-052-2/+4
| | | | | | | The roll-forward mechanism should be activated when the number of active logs is not 2. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: introduce -o fastboot for reducing booting time onlyJaegeuk Kim2014-11-045-6/+19
| | | | | | | | | If a system wants to reduce the booting time as a top priority, now we can use a mount option, -o fastboot. With this option, f2fs conducts a little bit slow write_checkpoint, but it can avoid the node page reads during the next mount time. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: remove unnecessary macroJaegeuk Kim2014-11-041-4/+0
| | | | | | Let's remove unused macro. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: avoid race condition in handling wait_ioJaegeuk Kim2014-11-043-29/+10
| | | | | | | | | | | | | | | | __submit_merged_bio f2fs_write_end_io f2fs_write_end_io wait_io = X wait_io = x complete(X) complete(X) wait_io = NULL wait_for_completion() free(X) spin_lock(X) kernel panic In order to avoid this, this patch removes the wait_io facility. Instead, we can use wait_on_all_pages_writeback(sbi) to wait for end_ios. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: send discard commands in larger extentJaegeuk Kim2014-11-041-17/+27
| | | | | | | | If there is a chance to make a huge sized discard command, we don't need to split it out, since each blkdev_issue_discard should wait one at a time. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: revisit inline_data to avoid data races and potential bugsJaegeuk Kim2014-11-047-212/+251
| | | | | | | | | | | This patch simplifies the inline_data usage with the following rule. 1. inline_data is set during the file creation. 2. If new data is requested to be written ranges out of inline_data, f2fs converts that inode permanently. 3. There is no cases which converts non-inline_data inode to inline_data. 4. The inline_data flag should be changed under inode page lock. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: remove pointless bit testing in f2fs_delete_entry()Jan Kara2014-11-031-1/+1
| | | | | | | | | There's no point in using test_and_clear_bit_le() when we don't use the return value of the function. Just use clear_bit_le() instead. Coverity-id: 1016434 Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: do not discard data protected by the previous checkpointJaegeuk Kim2014-11-031-1/+1
| | | | | | | We should not discard any data protected by the previous checkpoint all the time. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: flush_dcache_page for inline dataJaegeuk Kim2014-11-031-0/+1
| | | | | | When reading inline data, we should call flush_dcache_page. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: call write_checkpoint under disabled gcJaegeuk Kim2014-11-031-0/+2
| | | | | | | During the write_checkpoint, we should avoid f2fs_gc trigger to avoid any filesystem consistency. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: fix possible data corruption in f2fs_write_begin()Jan Kara2014-11-031-13/+11
| | | | | | | | | | | | f2fs_write_begin() doesn't initialize the 'dn' variable if the inode has inline data. However it uses its contents to decide whether it should just zero out the page or load data to it. Thus if we are unlucky we can zero out page contents instead of loading inline data into a page. CC: stable@vger.kernel.org CC: Changman Lee <cm224.lee@samsung.com> Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: use current_sit_addr to replace the open codeGu Zheng2014-11-031-11/+1
| | | | | Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: rename f2fs_set/clear_bit to f2fs_test_and_set/clear_bitGu Zheng2014-11-032-4/+4
| | | | | | | | Rename f2fs_set/clear_bit to f2fs_test_and_set/clear_bit, which mean set/clear bit and return the old value, for better readability. Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: set raw_super default to NULL to avoid compile warningGu Zheng2014-11-031-1/+1
| | | | | | | | Set raw_super default to NULL to avoid the possibly used uninitialized warning, though we may never hit it in fact. Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: introduce f2fs_change_bit to simplify the change bit logicGu Zheng2014-11-033-8/+11
| | | | | | | | Introduce f2fs_change_bit to simplify the change bit logic in function set_to_next_nat{sit}. Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: remove the redundant function cond_clear_inode_flagGu Zheng2014-11-032-11/+2
| | | | | | | Use clear_inode_flag to replace the redundant cond_clear_inode_flag. Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: remove the seems unneeded argument 'type' from __get_victimGu Zheng2014-11-031-3/+5
| | | | | | | | Remove the unneeded argument 'type' from __get_victim, use NO_CHECK_TYPE directly when calling v_ops->get_victim(). Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: avoid returning uninitialized value to userspace from f2fs_trim_fs()Jan Kara2014-11-031-1/+1
| | | | | | | | | | | | If user specifies too low end sector for trimming, f2fs_trim_fs() will use uninitialized value as a number of trimmed blocks and returns it to userspace. Initialize number of trimmed blocks early to avoid the problem. Coverity-id: 1248809 CC: stable@vger.kernel.org Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: declare f2fs_convert_inline_dir as a static functionJaegeuk Kim2014-11-031-1/+1
| | | | | | | This patch declares f2fs_convert_inline_dir as a static function, which was reported by kbuild test robot. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: use kmap_atomic instead of kmapJaegeuk Kim2014-11-031-9/+8
| | | | | | For better performance, we need to use kmap_atomic instead of kmap. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: reuse make_empty_dir code for inline_dentryJaegeuk Kim2014-11-033-33/+31
| | | | | | | This patch introduces do_make_empty_dir to mitigate code redundancy for inline_dentry. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: introduce f2fs_dentry_ptr structure for code clean-upJaegeuk Kim2014-11-033-46/+68
| | | | | | | This patch introduces f2fs_dentry_ptr structure for the use of a function parameter in inline_dentry operations. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: should not truncate any inline_dentryJaegeuk Kim2014-11-031-1/+1
| | | | | | If the inode has inline_dentry, we should not truncate any block indices. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: reuse core function in f2fs_readdir for inline_dentryJaegeuk Kim2014-11-033-58/+48
| | | | | | | This patch introduces a core function, f2fs_fill_dentries, to remove redundant code in f2fs_readdir and f2fs_read_inline_dir. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: fix counting inline_data inode numbersJaegeuk Kim2014-11-032-4/+2
| | | | | | This patch fixes wrongly counting inline_data inode numbers. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: add stat info for inline_dentry inodesJaegeuk Kim2014-11-035-3/+22
| | | | | | This patch adds status information for inline_dentry inodes. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: avoid deadlock on init_inode_metadataJaegeuk Kim2014-11-037-22/+157
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, init_inode_metadata does not hold any parent directory's inode page. So, f2fs_init_acl can grab its parent inode page without any problem. But, when we use inline_dentry, that page is grabbed during f2fs_add_link, so that we can fall into deadlock condition like below. INFO: task mknod:11006 blocked for more than 120 seconds. Tainted: G OE 3.17.0-rc1+ #13 "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. mknod D ffff88003fc94580 0 11006 11004 0x00000000 ffff880007717b10 0000000000000002 ffff88003c323220 ffff880007717fd8 0000000000014580 0000000000014580 ffff88003daecb30 ffff88003c323220 ffff88003fc94e80 ffff88003ffbb4e8 ffff880007717ba0 0000000000000002 Call Trace: [<ffffffff8173dc40>] ? bit_wait+0x50/0x50 [<ffffffff8173d4cd>] io_schedule+0x9d/0x130 [<ffffffff8173dc6c>] bit_wait_io+0x2c/0x50 [<ffffffff8173da3b>] __wait_on_bit_lock+0x4b/0xb0 [<ffffffff811640a7>] __lock_page+0x67/0x70 [<ffffffff810acf50>] ? autoremove_wake_function+0x40/0x40 [<ffffffff811652cc>] pagecache_get_page+0x14c/0x1e0 [<ffffffffa029afa9>] get_node_page+0x59/0x130 [f2fs] [<ffffffffa02a63ad>] read_all_xattrs+0x24d/0x430 [f2fs] [<ffffffffa02a6ca2>] f2fs_getxattr+0x52/0xe0 [f2fs] [<ffffffffa02a7481>] f2fs_get_acl+0x41/0x2d0 [f2fs] [<ffffffff8122d847>] get_acl+0x47/0x70 [<ffffffff8122db5a>] posix_acl_create+0x5a/0x150 [<ffffffffa02a7759>] f2fs_init_acl+0x29/0xcb [f2fs] [<ffffffffa0286a8d>] init_inode_metadata+0x5d/0x340 [f2fs] [<ffffffffa029253a>] f2fs_add_inline_entry+0x12a/0x2e0 [f2fs] [<ffffffffa0286ea5>] __f2fs_add_link+0x45/0x4a0 [f2fs] [<ffffffffa028b5b6>] ? f2fs_new_inode+0x146/0x220 [f2fs] [<ffffffffa028b816>] f2fs_mknod+0x86/0xf0 [f2fs] [<ffffffff811e3ec1>] vfs_mknod+0xe1/0x160 [<ffffffff811e4b26>] SyS_mknod+0x1f6/0x200 [<ffffffff81741d7f>] tracesys+0xe1/0xe6 Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: fix to wait correct block typeJaegeuk Kim2014-11-032-3/+4
| | | | | | The inode page needs to wait NODE block io. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: reuse find_in_block code for find_in_inline_dirJaegeuk Kim2014-11-033-63/+65
| | | | | | This patch removes redundant copied code in find_in_inline_dir. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: reuse room_for_filename for inline dentry operationJaegeuk Kim2014-11-033-37/+12
| | | | | | | This patch introduces to reuse the existing room_for_filename for inline dentry operation. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: update f2fs documentation for inline dir supportChao Yu2014-11-031-0/+4
| | | | | | | This patch adds descriptions for the inline dir support in f2fs document. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: enable inline dir handlingChao Yu2014-11-035-15/+58
| | | | | | | | | Add inline dir functions into normal dir ops' function to handle inline ops. Besides, we enable inline dir mode when a new dir inode is created if inline_data option is on. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: add key function to handle inline dirChao Yu2014-11-032-0/+355
| | | | | | | | Adds Functions to implement inline dir init/lookup/insert/delete/convert ops. Signed-off-by: Chao Yu <chao2.yu@samsung.com> [Jaegeuk Kim: remove needless reserved area copy, pointed by Dan Carpenter] Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: export dir operations for inline dirChao Yu2014-11-034-37/+50
| | | | | | | | This patch exports some dir operations for inline dir, additionally introduces f2fs_drop_nlink from f2fs_delete_entry for reusing by inline dir function. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: add a new mount option for inline dirChao Yu2014-11-031-0/+7
| | | | | | | Adds a new mount option 'inline_dentry' for inline dir. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: add infra struct and helper for inline dirChao Yu2014-11-032-2/+38
| | | | | | | | This patch defines macro/inline dentry structure, and adds some helpers for inline dir infrastructure. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: avoid infinite loop at cp_errorJaegeuk Kim2014-11-031-0/+3
| | | | | | | This patch avoids an infinite loop in sync_dirty_inode_page when -EIO was detected. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: avoid build warningJaegeuk Kim2014-11-031-1/+1
| | | | | | This patch removes build warning. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: fix to call f2fs_unlock_opJaegeuk Kim2014-11-031-1/+2
| | | | | | This patch fixes to call f2fs_unlock_op, which was missing before. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: avoid to allocate when inline_data was writtenJaegeuk Kim2014-11-032-13/+45
| | | | | | | | | | | | | | | | | The sceanrio is like this. inline_data i_size page write_begin/vm_page_mkwrite X 30 dirty_page X 30 write to #4096 position X 30 get_dnode_of_data wait for get_dnode_of_data O 30 write inline_data O 30 get_dnode_of_data O 30 reserve data block .. In this case, we have #0 = NEW_ADDR and inline_data as well. We should not allow this condition for further access. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: use highmem for directory pagesJaegeuk Kim2014-11-032-2/+3
| | | | | | This patch fixes to use highmem for directory pages. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
OpenPOWER on IntegriCloud