Thread (10 messages) 10 messages, 4 authors, 2020-08-26

Re: [PATCH v6 2/2] xfs: avoid transaction reservation recursion

From: Yafang Shao <hidden>
Date: 2020-08-25 01:40:03
Also in: linux-fsdevel, linux-xfs

On Tue, Aug 25, 2020 at 4:56 AM Matthew Wilcox [off-list ref] wrote:
On Mon, Aug 24, 2020 at 01:09:25PM -0700, Andrew Morton wrote:
quoted
On Mon, 24 Aug 2020 09:42:34 +0800 Yafang Shao [off-list ref] wrote:
quoted
--- a/include/linux/iomap.h
+++ b/include/linux/iomap.h
@@ -271,4 +271,11 @@ int iomap_swapfile_activate(struct swap_info_struct *sis,
 # define iomap_swapfile_activate(sis, swapfile, pagespan, ops)     (-EIO)
 #endif /* CONFIG_SWAP */

+/* Use the journal_info to indicate current is in a transaction */
+static inline bool
+fstrans_context_active(void)
+{
+   return current->journal_info != NULL;
+}
Why choose iomap.h for this?
Because it gets used in iomap/buffered-io.c

I don't think this is necessarily a useful abstraction, to be honest.
I'd just open-code 'if (current->journal_info)' or !current->journal_info,
whichever way round the code is:

fs/btrfs/delalloc-space.c:              if (current->journal_info)
fs/ceph/xattr.c:                if (current->journal_info) {
fs/gfs2/bmap.c:         if (current->journal_info) {
fs/jbd2/transaction.c:  if (WARN_ON(current->journal_info)) {
fs/reiserfs/super.c:    if (!current->journal_info) {

(to pluck a few examples from existing filesystems)
Make sense to me.
I will update it in the next version.

-- 
Thanks
Yafang
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help