@@ -571,18 +571,6 @@ void btrfs_remove_ordered_extent(struct inode *inode,
571571
572572 trace_btrfs_ordered_extent_remove (inode , entry );
573573
574- /*
575- * we have no more ordered extents for this inode and
576- * no dirty pages. We can safely remove it from the
577- * list of ordered extents
578- */
579- if (RB_EMPTY_ROOT (& tree -> tree ) &&
580- !mapping_tagged (inode -> i_mapping , PAGECACHE_TAG_DIRTY )) {
581- spin_lock (& root -> fs_info -> ordered_root_lock );
582- list_del_init (& BTRFS_I (inode )-> ordered_operations );
583- spin_unlock (& root -> fs_info -> ordered_root_lock );
584- }
585-
586574 if (!root -> nr_ordered_extents ) {
587575 spin_lock (& root -> fs_info -> ordered_root_lock );
588576 BUG_ON (list_empty (& root -> ordered_root ));
@@ -686,81 +674,6 @@ void btrfs_wait_ordered_roots(struct btrfs_fs_info *fs_info, int nr)
686674 mutex_unlock (& fs_info -> ordered_operations_mutex );
687675}
688676
689- /*
690- * this is used during transaction commit to write all the inodes
691- * added to the ordered operation list. These files must be fully on
692- * disk before the transaction commits.
693- *
694- * we have two modes here, one is to just start the IO via filemap_flush
695- * and the other is to wait for all the io. When we wait, we have an
696- * extra check to make sure the ordered operation list really is empty
697- * before we return
698- */
699- int btrfs_run_ordered_operations (struct btrfs_trans_handle * trans ,
700- struct btrfs_root * root , int wait )
701- {
702- struct btrfs_inode * btrfs_inode ;
703- struct inode * inode ;
704- struct btrfs_transaction * cur_trans = trans -> transaction ;
705- struct list_head splice ;
706- struct list_head works ;
707- struct btrfs_delalloc_work * work , * next ;
708- int ret = 0 ;
709-
710- INIT_LIST_HEAD (& splice );
711- INIT_LIST_HEAD (& works );
712-
713- mutex_lock (& root -> fs_info -> ordered_extent_flush_mutex );
714- spin_lock (& root -> fs_info -> ordered_root_lock );
715- list_splice_init (& cur_trans -> ordered_operations , & splice );
716- while (!list_empty (& splice )) {
717- btrfs_inode = list_entry (splice .next , struct btrfs_inode ,
718- ordered_operations );
719- inode = & btrfs_inode -> vfs_inode ;
720-
721- list_del_init (& btrfs_inode -> ordered_operations );
722-
723- /*
724- * the inode may be getting freed (in sys_unlink path).
725- */
726- inode = igrab (inode );
727- if (!inode )
728- continue ;
729-
730- if (!wait )
731- list_add_tail (& BTRFS_I (inode )-> ordered_operations ,
732- & cur_trans -> ordered_operations );
733- spin_unlock (& root -> fs_info -> ordered_root_lock );
734-
735- work = btrfs_alloc_delalloc_work (inode , wait , 1 );
736- if (!work ) {
737- spin_lock (& root -> fs_info -> ordered_root_lock );
738- if (list_empty (& BTRFS_I (inode )-> ordered_operations ))
739- list_add_tail (& btrfs_inode -> ordered_operations ,
740- & splice );
741- list_splice_tail (& splice ,
742- & cur_trans -> ordered_operations );
743- spin_unlock (& root -> fs_info -> ordered_root_lock );
744- ret = - ENOMEM ;
745- goto out ;
746- }
747- list_add_tail (& work -> list , & works );
748- btrfs_queue_work (root -> fs_info -> flush_workers ,
749- & work -> work );
750-
751- cond_resched ();
752- spin_lock (& root -> fs_info -> ordered_root_lock );
753- }
754- spin_unlock (& root -> fs_info -> ordered_root_lock );
755- out :
756- list_for_each_entry_safe (work , next , & works , list ) {
757- list_del_init (& work -> list );
758- btrfs_wait_and_free_delalloc_work (work );
759- }
760- mutex_unlock (& root -> fs_info -> ordered_extent_flush_mutex );
761- return ret ;
762- }
763-
764677/*
765678 * Used to start IO or wait for a given ordered extent to finish.
766679 *
@@ -1120,42 +1033,6 @@ int btrfs_find_ordered_sum(struct inode *inode, u64 offset, u64 disk_bytenr,
11201033 return index ;
11211034}
11221035
1123-
1124- /*
1125- * add a given inode to the list of inodes that must be fully on
1126- * disk before a transaction commit finishes.
1127- *
1128- * This basically gives us the ext3 style data=ordered mode, and it is mostly
1129- * used to make sure renamed files are fully on disk.
1130- *
1131- * It is a noop if the inode is already fully on disk.
1132- *
1133- * If trans is not null, we'll do a friendly check for a transaction that
1134- * is already flushing things and force the IO down ourselves.
1135- */
1136- void btrfs_add_ordered_operation (struct btrfs_trans_handle * trans ,
1137- struct btrfs_root * root , struct inode * inode )
1138- {
1139- struct btrfs_transaction * cur_trans = trans -> transaction ;
1140- u64 last_mod ;
1141-
1142- last_mod = max (BTRFS_I (inode )-> generation , BTRFS_I (inode )-> last_trans );
1143-
1144- /*
1145- * if this file hasn't been changed since the last transaction
1146- * commit, we can safely return without doing anything
1147- */
1148- if (last_mod <= root -> fs_info -> last_trans_committed )
1149- return ;
1150-
1151- spin_lock (& root -> fs_info -> ordered_root_lock );
1152- if (list_empty (& BTRFS_I (inode )-> ordered_operations )) {
1153- list_add_tail (& BTRFS_I (inode )-> ordered_operations ,
1154- & cur_trans -> ordered_operations );
1155- }
1156- spin_unlock (& root -> fs_info -> ordered_root_lock );
1157- }
1158-
11591036int __init ordered_data_init (void )
11601037{
11611038 btrfs_ordered_extent_cache = kmem_cache_create ("btrfs_ordered_extent" ,
0 commit comments