]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
mm: remove the for_reclaim field from struct writeback_control
authorChristoph Hellwig <hch@lst.de>
Tue, 10 Jun 2025 05:49:42 +0000 (07:49 +0200)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 10 Jul 2025 05:41:58 +0000 (22:41 -0700)
This field is now only set to one in the i915 gem code that only calls
writeback_iter on it, which ignores the flag.  All other checks are thuse
dead code and the field can be removed.

Link: https://lkml.kernel.org/r/20250610054959.2057526-7-hch@lst.de
Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: Chengming Zhou <chengming.zhou@linux.dev>
Cc: Hugh Dickins <hughd@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Nhat Pham <nphamcs@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/gpu/drm/i915/gem/i915_gem_shmem.c
fs/fuse/file.c
fs/nfs/write.c
include/linux/writeback.h
include/trace/events/btrfs.h
include/trace/events/writeback.h

index 24d8daa4fdb35b7869b8c24b345c8d6cb7a1fd87..f263615f6eceb71c0ee0e413330eb370a5ef97c3 100644 (file)
@@ -302,7 +302,6 @@ void __shmem_writeback(size_t size, struct address_space *mapping)
                .nr_to_write = SWAP_CLUSTER_MAX,
                .range_start = 0,
                .range_end = LLONG_MAX,
-               .for_reclaim = 1,
        };
        struct folio *folio = NULL;
        int error = 0;
index 47006d0753f1cdbf8155ae6dd7086be42e16a52e..95a657a5778684377301d4926ee95409c1ab5569 100644 (file)
@@ -1927,17 +1927,6 @@ int fuse_write_inode(struct inode *inode, struct writeback_control *wbc)
        struct fuse_file *ff;
        int err;
 
-       /*
-        * Inode is always written before the last reference is dropped and
-        * hence this should not be reached from reclaim.
-        *
-        * Writing back the inode from reclaim can deadlock if the request
-        * processing itself needs an allocation.  Allocations triggering
-        * reclaim while serving a request can't be prevented, because it can
-        * involve any number of unrelated userspace processes.
-        */
-       WARN_ON(wbc->for_reclaim);
-
        ff = __fuse_write_file_get(fi);
        err = fuse_flush_times(inode, ff);
        if (ff)
index 374fc6b34c7954ef781026e5114cf5411f366ecd..cf1d720b8251747753b9a0b5d21a65da61b83e1a 100644 (file)
@@ -720,7 +720,7 @@ int nfs_writepages(struct address_space *mapping, struct writeback_control *wbc)
        nfs_inc_stats(inode, NFSIOS_VFSWRITEPAGES);
 
        if (!(mntflags & NFS_MOUNT_WRITE_EAGER) || wbc->for_kupdate ||
-           wbc->for_background || wbc->for_sync || wbc->for_reclaim) {
+           wbc->for_background || wbc->for_sync) {
                ioc = nfs_io_completion_alloc(GFP_KERNEL);
                if (ioc)
                        nfs_io_completion_init(ioc, nfs_io_completion_commit,
index 9e960f2faf7945b2fec9e5e18a6ca2c91a6cfe99..a2848d731a466387dabc3e1fe7e6998cf083b7cf 100644 (file)
@@ -59,7 +59,6 @@ struct writeback_control {
        unsigned for_kupdate:1;         /* A kupdate writeback */
        unsigned for_background:1;      /* A background writeback */
        unsigned tagged_writepages:1;   /* tag-and-write to avoid livelock */
-       unsigned for_reclaim:1;         /* Invoked from the page allocator */
        unsigned range_cyclic:1;        /* range_start is cyclic */
        unsigned for_sync:1;            /* sync(2) WB_SYNC_ALL writeback */
        unsigned unpinned_netfs_wb:1;   /* Cleared I_PINNING_NETFS_WB */
index bebc252db8654f9f1fe783f83ceac7d03434866b..0adc40f5e72b6649d4ae7af0aeb1d52ef7e1555e 100644 (file)
@@ -686,7 +686,6 @@ DECLARE_EVENT_CLASS(btrfs__writepage,
                __field(        loff_t, range_start             )
                __field(        loff_t, range_end               )
                __field(        char,   for_kupdate             )
-               __field(        char,   for_reclaim             )
                __field(        char,   range_cyclic            )
                __field(        unsigned long,  writeback_index )
                __field(        u64,    root_objectid           )
@@ -700,7 +699,6 @@ DECLARE_EVENT_CLASS(btrfs__writepage,
                __entry->range_start    = wbc->range_start;
                __entry->range_end      = wbc->range_end;
                __entry->for_kupdate    = wbc->for_kupdate;
-               __entry->for_reclaim    = wbc->for_reclaim;
                __entry->range_cyclic   = wbc->range_cyclic;
                __entry->writeback_index = inode->i_mapping->writeback_index;
                __entry->root_objectid  = btrfs_root_id(BTRFS_I(inode)->root);
@@ -709,13 +707,12 @@ DECLARE_EVENT_CLASS(btrfs__writepage,
        TP_printk_btrfs("root=%llu(%s) ino=%llu page_index=%lu "
                  "nr_to_write=%ld pages_skipped=%ld range_start=%llu "
                  "range_end=%llu for_kupdate=%d "
-                 "for_reclaim=%d range_cyclic=%d writeback_index=%lu",
+                 "range_cyclic=%d writeback_index=%lu",
                  show_root_type(__entry->root_objectid),
                  __entry->ino, __entry->index,
                  __entry->nr_to_write, __entry->pages_skipped,
                  __entry->range_start, __entry->range_end,
-                 __entry->for_kupdate,
-                 __entry->for_reclaim, __entry->range_cyclic,
+                 __entry->for_kupdate, __entry->range_cyclic,
                  __entry->writeback_index)
 );
 
index 0ff388131fc95f34ed90c55058fe461783c35817..1e23919c0da981319f3deee29b482116c73a8064 100644 (file)
@@ -459,7 +459,6 @@ DECLARE_EVENT_CLASS(wbc_class,
                __field(int, sync_mode)
                __field(int, for_kupdate)
                __field(int, for_background)
-               __field(int, for_reclaim)
                __field(int, range_cyclic)
                __field(long, range_start)
                __field(long, range_end)
@@ -473,23 +472,20 @@ DECLARE_EVENT_CLASS(wbc_class,
                __entry->sync_mode      = wbc->sync_mode;
                __entry->for_kupdate    = wbc->for_kupdate;
                __entry->for_background = wbc->for_background;
-               __entry->for_reclaim    = wbc->for_reclaim;
                __entry->range_cyclic   = wbc->range_cyclic;
                __entry->range_start    = (long)wbc->range_start;
                __entry->range_end      = (long)wbc->range_end;
                __entry->cgroup_ino     = __trace_wbc_assign_cgroup(wbc);
        ),
 
-       TP_printk("bdi %s: towrt=%ld skip=%ld mode=%d kupd=%d "
-               "bgrd=%d reclm=%d cyclic=%d "
-               "start=0x%lx end=0x%lx cgroup_ino=%lu",
+       TP_printk("bdi %s: towrt=%ld skip=%ld mode=%d kupd=%d bgrd=%d "
+               "cyclic=%d start=0x%lx end=0x%lx cgroup_ino=%lu",
                __entry->name,
                __entry->nr_to_write,
                __entry->pages_skipped,
                __entry->sync_mode,
                __entry->for_kupdate,
                __entry->for_background,
-               __entry->for_reclaim,
                __entry->range_cyclic,
                __entry->range_start,
                __entry->range_end,