From 09713447858c00501d9ab0d55cd66b454bc93f62 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Wed, 29 Jun 2022 17:54:20 +0100 Subject: [PATCH] improve behaviour of pipelines with seq sources Loaders which supported random access would not set the seq flag even if seq mode was requested. This would make operations like shrinkv to not run in seq mode, causing massive cache thrashing. See https://github.com/libvips/libvips/discussions/2898 --- libvips/foreign/foreign.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libvips/foreign/foreign.c b/libvips/foreign/foreign.c index 78f64e92..7597131e 100644 --- a/libvips/foreign/foreign.c +++ b/libvips/foreign/foreign.c @@ -1064,9 +1064,9 @@ vips_foreign_load_build( VipsObject *object ) g_object_set( load, "flags", flags, NULL ); - /* Seq access has been requested and the loader supports seq. + /* Seq access has been requested, or the loader requires seq. */ - sequential = (load->flags & VIPS_FOREIGN_SEQUENTIAL) && + sequential = (load->flags & VIPS_FOREIGN_SEQUENTIAL) || load->access != VIPS_ACCESS_RANDOM; /* We must block caching of seq loads. @@ -1136,7 +1136,7 @@ vips_foreign_load_build( VipsObject *object ) /* Tell downstream if we are reading sequentially. */ - if( sequential ) + if( sequential ) vips_image_set_int( load->out, VIPS_META_SEQUENTIAL, 1 ); return( 0 );