summaryrefslogtreecommitdiffstats
path: root/fs
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | | | | kill iov_iter_copy_from_user()Al Viro2014-05-062-6/+4Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | all callers can use copy_page_from_iter() and it actually simplifies them. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | | | | | fs/file.c: don't open-code kvfree()Al Viro2014-05-061-8/+3Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | | | | | Merge branch 'for_linus' of ↵Linus Torvalds2014-06-1125-4916/+7052
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs Pull reiserfs and ext3 changes from Jan Kara: "Big reiserfs cleanup from Jeff, an ext3 deadlock fix, and some small cleanups" * 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs: (34 commits) reiserfs: Fix compilation breakage with CONFIG_REISERFS_CHECK ext3: Fix deadlock in data=journal mode when fs is frozen reiserfs: call truncate_setsize under tailpack mutex fs/jbd/revoke.c: replace shift loop by ilog2 reiserfs: remove obsolete __constant_cpu_to_le32 reiserfs: balance_leaf refactor, split up balance_leaf_when_delete reiserfs: balance_leaf refactor, format balance_leaf_finish_node reiserfs: balance_leaf refactor, format balance_leaf_new_nodes_paste reiserfs: balance_leaf refactor, format balance_leaf_paste_right reiserfs: balance_leaf refactor, format balance_leaf_insert_right reiserfs: balance_leaf refactor, format balance_leaf_paste_left reiserfs: balance_leaf refactor, format balance_leaf_insert_left reiserfs: balance_leaf refactor, pull out balance_leaf{left, right, new_nodes, finish_node} reiserfs: balance_leaf refactor, pull out balance_leaf_finish_node_paste reiserfs: balance_leaf refactor pull out balance_leaf_finish_node_insert reiserfs: balance_leaf refactor, pull out balance_leaf_new_nodes_paste reiserfs: balance_leaf refactor, pull out balance_leaf_new_nodes_insert reiserfs: balance_leaf refactor, pull out balance_leaf_paste_right reiserfs: balance_leaf refactor, pull out balance_leaf_insert_right reiserfs: balance_leaf refactor, pull out balance_leaf_paste_left ...
| * | | | | | | reiserfs: Fix compilation breakage with CONFIG_REISERFS_CHECKJan Kara2014-06-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There was a bug in debug printout when CONFIG_REISERFS_CHECK was enabled so one of the assertions in do_balan.c didn't compile. Fix it. Fixes: 0080e9f9d3ac717537dbd6db1fc8ef72ce0b9cc1 Signed-off-by: Jan Kara <jack@suse.cz>
| * | | | | | | ext3: Fix deadlock in data=journal mode when fs is frozenJan Kara2014-05-221-16/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When ext3 is used in data=journal mode, syncing filesystem makes sure all the data is committed in the journal but the data doesn't have to be checkpointed. ext3_freeze() then takes care of checkpointing all the data so all buffer heads are clean but pages can still have dangling dirty bits. So when flusher thread comes later when filesystem is frozen, it tries to write back dirty pages, ext3_journalled_writepage() tries to start a transaction and hangs waiting for frozen fs causing a deadlock because a holder of s_umount semaphore may be waiting for flusher thread to complete. The fix is luckily relatively easy. We don't have to start a transaction in ext3_journalled_writepage() when a page is just dirty (and doesn't have PageChecked set) because in that case all buffers should be already mapped (mapping must happen before writing a buffer to the journal) and it is enough to write them out. This optimization also solves the deadlock because block_write_full_page() will just find out there's no buffer to write and do nothing. Signed-off-by: Jan Kara <jack@suse.cz>
| * | | | | | | reiserfs: call truncate_setsize under tailpack mutexJeff Mahoney2014-05-211-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prior to commit 0e4f6a791b1e (Fix reiserfs_file_release()), reiserfs truncates serialized on i_mutex. They mostly still do, with the exception of reiserfs_file_release. That blocks out other writers via the tailpack mutex and the inode openers counter adjusted in reiserfs_file_open. However, NFS will call reiserfs_setattr without having called ->open, so we end up with a race when nfs is calling ->setattr while another process is releasing the file. Ultimately, it triggers the BUG_ON(inode->i_size != new_file_size) check in maybe_indirect_to_direct. The solution is to pull the lock into reiserfs_setattr to encompass the truncate_setsize call as well. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Cc: <stable@vger.kernel.org> Signed-off-by: Jan Kara <jack@suse.cz>
| * | | | | | | fs/jbd/revoke.c: replace shift loop by ilog2Fabian Frederick2014-05-211-8/+4Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | journal_init_revoke_table is only called with positive hash_size (JOURNAL_REVOKE_DEFAULT_HASH) so we can replace loop shift by ilog2 Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Jan Kara <jack@suse.cz> Cc: Joe Perches <joe@perches.com> Signed-off-by: Fabian Frederick <fabf@skynet.be> Signed-off-by: Jan Kara <jack@suse.cz>
| * | | | | | | reiserfs: remove obsolete __constant_cpu_to_le32Fabian Frederick2014-05-141-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | __constant_cpu_to_le32 converted to cpu_to_le32 Cc: reiserfs-devel@vger.kernel.org Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Fabian Frederick <fabf@skynet.be> Signed-off-by: Jan Kara <jack@suse.cz>
| * | | | | | | reiserfs: balance_leaf refactor, split up balance_leaf_when_deleteJeff Mahoney2014-05-131-155/+163
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Splut up balance_leaf_when_delete into: balance_leaf_when_delete_del balance_leaf_when_cut balance_leaf_when_delete_left Also reformat to adhere to CodingStyle. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Jan Kara <jack@suse.cz>
| * | | | | | | reiserfs: balance_leaf refactor, format balance_leaf_finish_nodeJeff Mahoney2014-05-131-92/+73Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Split out balance_leaf_finish_node_dirent from balance_leaf_paste_finish_node. Also reformat to adhere to CodingStyle. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Jan Kara <jack@suse.cz>
| * | | | | | | reiserfs: balance_leaf refactor, format balance_leaf_new_nodes_pasteJeff Mahoney2014-05-131-205/+271
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Break up balance_leaf_paste_new_nodes into: balance_leaf_paste_new_nodes_shift balance_leaf_paste_new_nodes_shift_dirent balance_leaf_paste_new_nodes_whole and keep balance_leaf_paste_new_nodes as a handler to select which is appropriate. Also reformat to adhere to CodingStyle. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Jan Kara <jack@suse.cz>
| * | | | | | | reiserfs: balance_leaf refactor, format balance_leaf_paste_rightJeff Mahoney2014-05-071-125/+165
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Break up balance_leaf_paste_right into: balance_leaf_paste_right_shift balance_leaf_paste_right_shift_dirent balance_leaf_paste_right_whole and keep balance_leaf_paste_right as a handler to select which is appropriate. Also reformat to adhere to CodingStyle. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Jan Kara <jack@suse.cz>
| * | | | | | | reiserfs: balance_leaf refactor, format balance_leaf_insert_rightJeff Mahoney2014-05-071-52/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reformat balance_leaf_insert_right to adhere to CodingStyle. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Jan Kara <jack@suse.cz>
| * | | | | | | reiserfs: balance_leaf refactor, format balance_leaf_paste_leftJeff Mahoney2014-05-071-139/+222
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Break up balance_leaf_paste_left into: balance_leaf_paste_left_shift balance_leaf_paste_left_shift_dirent balance_leaf_paste_left_whole and keep balance_leaf_paste_left as a handler to select which is appropriate. Also reformat to adhere to CodingStyle. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Jan Kara <jack@suse.cz>
| * | | | | | | reiserfs: balance_leaf refactor, format balance_leaf_insert_leftJeff Mahoney2014-05-071-43/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reformat balance_leaf_insert_left to adhere to CodingStyle. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Jan Kara <jack@suse.cz>
| * | | | | | | reiserfs: balance_leaf refactor, pull out balance_leaf{left, right, ↵Jeff Mahoney2014-05-071-99/+108
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | new_nodes, finish_node} Break out the code that splits paste/insert for each phase. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Jan Kara <jack@suse.cz>
| * | | | | | | reiserfs: balance_leaf refactor, pull out balance_leaf_finish_node_pasteJeff Mahoney2014-05-071-71/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch factors out a new balance_leaf_finish_node_paste from the code in balance_leaf responsible for pasting new content into existing items held in S[0]. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Jan Kara <jack@suse.cz>
| * | | | | | | reiserfs: balance_leaf refactor pull out balance_leaf_finish_node_insertJeff Mahoney2014-05-071-9/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch factors out a new balance_leaf_finish_node_insert from the code in balance_leaf responsible for inserting new items into S[0] It has not been reformatted yet. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Jan Kara <jack@suse.cz>
| * | | | | | | reiserfs: balance_leaf refactor, pull out balance_leaf_new_nodes_pasteJeff Mahoney2014-05-071-146/+160
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch factors out a new balance_leaf_new_nodes_insert from the code in balance_leaf responsible for pasting new content into existing items that may have been shifted into new nodes in the tree. It has not been reformatted yet. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Jan Kara <jack@suse.cz>
| * | | | | | | reiserfs: balance_leaf refactor, pull out balance_leaf_new_nodes_insertJeff Mahoney2014-05-071-60/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch factors out a new balance_leaf_new_nodes_insert from the code in balance_leaf responsible for inserting new items into new nodes in the tree. It has not been reformatted yet. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Jan Kara <jack@suse.cz>
| * | | | | | | reiserfs: balance_leaf refactor, pull out balance_leaf_paste_rightJeff Mahoney2014-05-071-80/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch factors out a new balance_leaf_paste_right from the code in balance_leaf responsible for pasting new contents into an existing item located in the node to the right of S[0] in the tree. It has not been reformatted yet. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Jan Kara <jack@suse.cz>
| * | | | | | | reiserfs: balance_leaf refactor, pull out balance_leaf_insert_rightJeff Mahoney2014-05-071-63/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch factors out a new balance_leaf_insert_right from the code in balance_leaf responsible for inserting new items into the node to the right of S[0] in the tree. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Jan Kara <jack@suse.cz>
| * | | | | | | reiserfs: balance_leaf refactor, pull out balance_leaf_paste_leftJeff Mahoney2014-05-071-53/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch factors out a new balance_leaf_paste_left from the code in balance_leaf responsible for pasting new content into an existing item located in the node to the left of S[0] in the tree. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Jan Kara <jack@suse.cz>
| * | | | | | | reiserfs: balance_leaf refactor, pull out balance_leaf_insert_leftJeff Mahoney2014-05-071-49/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch factors out a new balance_leaf_insert_left from the code in balance_leaf responsible for inserting new items into the node to the left of S[0] in the tree. It is not yet formatted correctly. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Jan Kara <jack@suse.cz>
| * | | | | | | reiserfs: balance_leaf refactor, move state variables into tree_balanceJeff Mahoney2014-05-074-222/+214Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch pushes the rest of the state variables in balance_leaf into the tree_balance structure so we can use them when we split balance_leaf into separate functions. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Jan Kara <jack@suse.cz>
| * | | | | | | reiserfs: balance_leaf refactor, reformat balance_leaf commentsJeff Mahoney2014-05-071-32/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The comments in balance_leaf are as bad as the code. This patch shifts them around to fit in 80 columns and be easier to read. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Jan Kara <jack@suse.cz>
| * | | | | | | reiserfs: cleanup, make hash detection sanerJeff Mahoney2014-05-071-58/+47Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The hash detection code uses long ugly macros multiple times to get the same value. This patch cleans it up to be easier to read. [JK: Fixed up path leak in find_hash_out()] Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Jan Kara <jack@suse.cz>
| * | | | | | | reiserfs: cleanup, remove unnecessary parensJeff Mahoney2014-05-0615-130/+129Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The reiserfs code is littered with extra parens in places where the authors may not have been certain about precedence of & vs ->. This patch cleans them out. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Jan Kara <jack@suse.cz>
| * | | | | | | reiserfs: cleanup, remove leading whitespace from labelsJeff Mahoney2014-05-0611-68/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch moves reiserfs closer to adhering to the style rules by removing leading whitespace from labels. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Jan Kara <jack@suse.cz>
| * | | | | | | reiserfs: cleanup, remove unnecessary parens in dirent creationJeff Mahoney2014-05-061-33/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | make_empty_dir_item_v1 and make_empty_dir_item also needed a bit of cleanup but it's clearer to use separate pointers rather than the array positions for just two items. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Jan Kara <jack@suse.cz>
| * | | | | | | reiserfs: cleanup, remove blocks arg from journal_joinJeff Mahoney2014-05-063-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | journal_join is always called with a block count of 1. Let's just get rid of the argument. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Jan Kara <jack@suse.cz>
| * | | | | | | reiserfs: cleanup, remove sb argument from journal_mark_dirtyJeff Mahoney2014-05-0612-38/+35Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | journal_mark_dirty doesn't need a separate sb argument; It's provided by the transaction handle. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Jan Kara <jack@suse.cz>
| * | | | | | | reiserfs: cleanup, remove sb argument from journal_endJeff Mahoney2014-05-0610-79/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | journal_end doesn't need a separate sb argument; it's provided by the transaction handle. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Jan Kara <jack@suse.cz>
| * | | | | | | reiserfs: cleanup, remove nblocks argument from journal_endJeff Mahoney2014-05-0610-90/+75Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | journal_end takes a block count argument but doesn't actually use it for anything. We can remove it. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Jan Kara <jack@suse.cz>
| * | | | | | | reiserfs: cleanup, reformat comments to normal kernel styleJeff Mahoney2014-05-0623-3311/+5124
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch reformats comments in the reiserfs code to fit in 80 columns and to follow the style rules. There is no functional change but it helps make my eyes bleed less. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Jan Kara <jack@suse.cz>
| * | | | | | | reiserfs: cleanup, rename key and item accessors to more friendly namesJeff Mahoney2014-05-0614-239/+284
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch does a quick search and replace: B_N_PITEM_HEAD() -> item_head() B_N_PDELIM_KEY() -> internal_key() B_N_PKEY() -> leaf_key() B_N_PITEM() -> item_body() And the item_head version: B_I_PITEM() -> ih_item_body() I_ENTRY_COUNT() -> ih_entry_count() And the treepath variants: get_ih() -> tp_item_head() PATH_PITEM_HEAD() -> tp_item_head() get_item() -> tp_item_body() ... which makes the code much easier on the eyes. I've also removed a few unused macros. Checkpatch will complain about the 80 character limit for do_balan.c. I've addressed that in a later patchset to split up balance_leaf(). Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Jan Kara <jack@suse.cz>
| * | | | | | | reiserfs: use per-fs commit workqueuesJeff Mahoney2014-05-063-25/+20Star
| |/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The reiserfs write lock hasn't been the BKL for some time. There's no need to have different file systems queued up on the same workqueue. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Jan Kara <jack@suse.cz>
* | | | | | | Merge branch 'for-linus' of ↵Linus Torvalds2014-06-1146-1303/+3693
|\ \ \ \ \ \ \ | | |_|_|_|_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs Pull btrfs updates from Chris Mason: "The biggest change here is Josef's rework of the btrfs quota accounting, which improves the in-memory tracking of delayed extent operations. I had been working on Btrfs stack usage for a while, mostly because it had become impossible to do long stress runs with slab, lockdep and pagealloc debugging turned on without blowing the stack. Even though you upgraded us to a nice king sized stack, I kept most of the patches. We also have some very hard to find corruption fixes, an awesome sysfs use after free, and the usual assortment of optimizations, cleanups and other fixes" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs: (80 commits) Btrfs: convert smp_mb__{before,after}_clear_bit Btrfs: fix scrub_print_warning to handle skinny metadata extents Btrfs: make fsync work after cloning into a file Btrfs: use right type to get real comparison Btrfs: don't check nodes for extent items Btrfs: don't release invalid page in btrfs_page_exists_in_range() Btrfs: make sure we retry if page is a retriable exception Btrfs: make sure we retry if we couldn't get the page btrfs: replace EINVAL with EOPNOTSUPP for dev_replace raid56 trivial: fs/btrfs/ioctl.c: fix typo s/substract/subtract/ Btrfs: fix leaf corruption after __btrfs_drop_extents Btrfs: ensure btrfs_prev_leaf doesn't miss 1 item Btrfs: fix clone to deal with holes when NO_HOLES feature is enabled btrfs: free delayed node outside of root->inode_lock btrfs: replace EINVAL with ERANGE for resize when ULLONG_MAX Btrfs: fix transaction leak during fsync call btrfs: Avoid trucating page or punching hole in a already existed hole. Btrfs: update commit root on snapshot creation after orphan cleanup Btrfs: ioctl, don't re-lock extent range when not necessary Btrfs: avoid visiting all extent items when cloning a range ...
| * | | | | | Btrfs: convert smp_mb__{before,after}_clear_bitChris Mason2014-06-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new call is smp_mb__{before,after}_atomic. The __ gives us extra protection from the atomic rays. Signed-off-by: Chris Mason <clm@fb.com>
| * | | | | | Btrfs: fix scrub_print_warning to handle skinny metadata extentsLiu Bo2014-06-103-15/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The skinny extents are intepreted incorrectly in scrub_print_warning(), and end up hitting the BUG() in btrfs_extent_inline_ref_size. Reported-by: Konstantinos Skarlatos <k.skarlatos@gmail.com> Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Signed-off-by: Chris Mason <clm@fb.com>
| * | | | | | Btrfs: make fsync work after cloning into a fileFilipe Manana2014-06-104-38/+155
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When cloning into a file, we were correctly replacing the extent items in the target range and removing the extent maps. However we weren't replacing the extent maps with new ones that point to the new extents - as a consequence, an incremental fsync (when the inode doesn't have the full sync flag) was a NOOP, since it relies on the existence of extent maps in the modified list of the inode's extent map tree, which was empty. Therefore add new extent maps to reflect the target clone range. A test case for xfstests follows. Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com> Signed-off-by: Chris Mason <clm@fb.com>
| * | | | | | Btrfs: use right type to get real comparisonLiu Bo2014-06-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We want to make sure the point is still within the extent item, not to verify the memory it's pointing to. Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Signed-off-by: Chris Mason <clm@fb.com>
| * | | | | | Btrfs: don't check nodes for extent itemsJosef Bacik2014-06-101-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The backref code was looking at nodes as well as leaves when we tried to populate extent item entries. This is not good, and although we go away with it for the most part because we'd skip where disk_bytenr != random_memory, sometimes random_memory would match and suddenly boom. This fixes that problem. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: Chris Mason <clm@fb.com>
| * | | | | | Btrfs: don't release invalid page in btrfs_page_exists_in_range()Filipe Manana2014-06-101-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In inode.c:btrfs_page_exists_in_range(), if the page we got from the radix tree is an exception entry, which can't be retried, we exit the loop with a non-NULL page and then call page_cache_release against it, which is not ok since it's not a valid page. This could also make us return true when we shouldn't. Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com> Signed-off-by: Chris Mason <clm@fb.com>
| * | | | | | Btrfs: make sure we retry if page is a retriable exceptionFilipe Manana2014-06-101-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In inode.c:btrfs_page_exists_in_range(), if the page we get from the radix tree is an exception which should make us retry, set page to NULL in order to really retry, because otherwise we don't get another loop iteration executed (page != NULL makes the while loop exit). This also was making us call page_cache_release after exiting the loop, which isn't correct because page doesn't point to a valid page, and possibly return true from the function when we shouldn't. Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com> Signed-off-by: Chris Mason <clm@fb.com>
| * | | | | | Btrfs: make sure we retry if we couldn't get the pageFilipe Manana2014-06-101-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In inode.c:btrfs_page_exists_in_range(), if we can't get the page we need to retry. However we weren't retrying because we weren't setting page to NULL, which makes the while loop exit immediately and will make us call page_cache_release after exiting the loop which is incorrect because our page get didn't succeed. This could also make us return true when we shouldn't. Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com> Signed-off-by: Chris Mason <clm@fb.com>
| * | | | | | btrfs: replace EINVAL with EOPNOTSUPP for dev_replace raid56Gui Hecheng2014-06-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To return EOPNOTSUPP is more user friendly than to return EINVAL, and then user-space tool will show that the dev_replace operation for raid56 is not currently supported rather than showing that there is an invalid argument. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: Chris Mason <clm@fb.com>
| * | | | | | trivial: fs/btrfs/ioctl.c: fix typo s/substract/subtract/Antonio Ospite2014-06-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Antonio Ospite <ao2@ao2.it> Cc: Chris Mason <clm@fb.com> Cc: Josef Bacik <jbacik@fb.com> Cc: linux-btrfs@vger.kernel.org Signed-off-by: Chris Mason <clm@fb.com>
| * | | | | | Btrfs: fix leaf corruption after __btrfs_drop_extentsLiu Bo2014-06-101-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Several reports about leaf corruption has been floating on the list, one of them points to __btrfs_drop_extents(), and we find that the leaf becomes corrupted after __btrfs_drop_extents(), it's really a rare case but it does exist. The problem turns out to be btrfs_next_leaf() called in __btrfs_drop_extents(). So in btrfs_next_leaf(), we release the current path to re-search the last key of the leaf for locating next leaf, and we've taken it into account that there might be balance operations between leafs during this 'unlock and re-lock' dance, so we check the path again and advance it if there are now more items available. But things are a bit different if that last key happens to be removed and balance gets a bigger key as the last one, and btrfs_search_slot will return it with ret > 0, IOW, nothing change in this leaf except the new last key, then we think we're okay because there is no more item balanced in, fine, we thinks we can go to the next leaf. However, we should return that bigger key, otherwise we deserve leaf corruption, for example, in endio, skipping that key means that __btrfs_drop_extents() thinks it has dropped all extent matched the required range and finish_ordered_io can safely insert a new extent, but it actually doesn't and ends up a leaf corruption. One may be asking that why our locking on extent io tree doesn't work as expected, ie. it should avoid this kind of race situation. But in __btrfs_drop_extents(), we don't always find extents which are included within our locking range, IOW, extents can start before our searching start, in this case locking on extent io tree doesn't protect us from the race. This takes the special case into account. Reviewed-by: Filipe Manana <fdmanana@gmail.com> Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Signed-off-by: Chris Mason <clm@fb.com>
| * | | | | | Btrfs: ensure btrfs_prev_leaf doesn't miss 1 itemFilipe Manana2014-06-101-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We might have had an item with the previous key in the tree right before we released our path. And after we released our path, that item might have been pushed to the first slot (0) of the leaf we were holding due to a tree balance. Alternatively, an item with the previous key can exist as the only element of a leaf (big fat item). Therefore account for these 2 cases, so that our callers (like btrfs_previous_item) don't miss an existing item with a key matching the previous key we computed above. Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com> Signed-off-by: Chris Mason <clm@fb.com>