]> git.baikalelectronics.ru Git - kernel.git/commitdiff
Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso...
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 30 Nov 2019 18:53:02 +0000 (10:53 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 30 Nov 2019 18:53:02 +0000 (10:53 -0800)
Pull ext4 updates from Ted Ts'o:
 "This merge window saw the the following new featuers added to ext4:

   - Direct I/O via iomap (required the iomap-for-next branch from
     Darrick as a prereq).

   - Support for using dioread-nolock where the block size < page size.

   - Support for encryption for file systems where the block size < page
     size.

   - Rework of journal credits handling so a revoke-heavy workload will
     not cause the journal to run out of space.

   - Replace bit-spinlocks with spinlocks in jbd2

  Also included were some bug fixes and cleanups, mostly to clean up
  corner cases from fuzzed file systems and error path handling"

* tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: (59 commits)
  ext4: work around deleting a file with i_nlink == 0 safely
  ext4: add more paranoia checking in ext4_expand_extra_isize handling
  jbd2: make jbd2_handle_buffer_credits() handle reserved handles
  ext4: fix a bug in ext4_wait_for_tail_page_commit
  ext4: bio_alloc with __GFP_DIRECT_RECLAIM never fails
  ext4: code cleanup for get_next_id
  ext4: fix leak of quota reservations
  ext4: remove unused variable warning in parse_options()
  ext4: Enable encryption for subpage-sized blocks
  fs/buffer.c: support fscrypt in block_read_full_page()
  ext4: Add error handling for io_end_vec struct allocation
  jbd2: Fine tune estimate of necessary descriptor blocks
  jbd2: Provide trace event for handle restarts
  ext4: Reserve revoke credits for freed blocks
  jbd2: Make credit checking more strict
  jbd2: Rename h_buffer_credits to h_total_credits
  jbd2: Reserve space for revoke descriptor blocks
  jbd2: Drop jbd2_space_needed()
  jbd2: Account descriptor blocks into t_outstanding_credits
  jbd2: Factor out common parts of stopping and restarting a handle
  ...

1  2 
Documentation/filesystems/fscrypt.rst
fs/ext4/ext4.h
fs/ext4/inode.c
fs/ext4/super.c
fs/jbd2/transaction.c
fs/ocfs2/journal.c
include/linux/jbd2.h

Simple merge
diff --cc fs/ext4/ext4.h
Simple merge
diff --cc fs/ext4/inode.c
Simple merge
diff --cc fs/ext4/super.c
Simple merge
index b25ebdcabfa3ec32dd6fe0fae977b331ef1e1c5c,c068912408dd52a28a69b1ee56909bfb4efb6e49..27b9f9dee4347e2f85de856c33650a9ff4f5ab2c
@@@ -655,6 -690,49 +690,49 @@@ error_out
        return result;
  }
  
 -      rwsem_release(&journal->j_trans_commit_map, 1, _THIS_IP_);
+ static void stop_this_handle(handle_t *handle)
+ {
+       transaction_t *transaction = handle->h_transaction;
+       journal_t *journal = transaction->t_journal;
+       int revokes;
+       J_ASSERT(journal_current_handle() == handle);
+       J_ASSERT(atomic_read(&transaction->t_updates) > 0);
+       current->journal_info = NULL;
+       /*
+        * Subtract necessary revoke descriptor blocks from handle credits. We
+        * take care to account only for revoke descriptor blocks the
+        * transaction will really need as large sequences of transactions with
+        * small numbers of revokes are relatively common.
+        */
+       revokes = handle->h_revoke_credits_requested - handle->h_revoke_credits;
+       if (revokes) {
+               int t_revokes, revoke_descriptors;
+               int rr_per_blk = journal->j_revoke_records_per_block;
+               WARN_ON_ONCE(DIV_ROUND_UP(revokes, rr_per_blk)
+                               > handle->h_total_credits);
+               t_revokes = atomic_add_return(revokes,
+                               &transaction->t_outstanding_revokes);
+               revoke_descriptors =
+                       DIV_ROUND_UP(t_revokes, rr_per_blk) -
+                       DIV_ROUND_UP(t_revokes - revokes, rr_per_blk);
+               handle->h_total_credits -= revoke_descriptors;
+       }
+       atomic_sub(handle->h_total_credits,
+                  &transaction->t_outstanding_credits);
+       if (handle->h_rsv_handle)
+               __jbd2_journal_unreserve_handle(handle->h_rsv_handle);
+       if (atomic_dec_and_test(&transaction->t_updates))
+               wake_up(&journal->j_wait_updates);
++      rwsem_release(&journal->j_trans_commit_map, _THIS_IP_);
+       /*
+        * Scope of the GFP_NOFS context is over here and so we can restore the
+        * original alloc context.
+        */
+       memalloc_nofs_restore(handle->saved_alloc_context);
+ }
  
  /**
   * int jbd2_journal_restart() - restart a handle .
Simple merge
Simple merge