022c9c
commit e40b26c5bbaab6fc8068fe5c111bdfeff0963408
022c9c
Author: Paulo Andrade <pandrade@redhat.com>
022c9c
Date:   Tue Jun 12 18:48:26 2018 -0400
022c9c
022c9c
    rhbz1547238: adapt vfs.add_to_page_cache probes
022c9c
    
022c9c
    The add_to_page_cache_lru variant should also be probed, along with
022c9c
    kernel.function("add_to_page_cache_locked"), but if present, not the
022c9c
    add_to_page_cache variant.  This backward compatibility needed a
022c9c
    little bit of tapset probe point operator jiujitsu to go beyond
022c9c
    Paulo's initial patch.
022c9c
022c9c
diff --git a/tapset/linux/vfs.stp b/tapset/linux/vfs.stp
022c9c
index 6f5fe77..1fe71ae 100644
022c9c
--- a/tapset/linux/vfs.stp
022c9c
+++ b/tapset/linux/vfs.stp
022c9c
@@ -908,9 +908,16 @@ probe __vfs.ext4_mpage_readpages.return =
022c9c
 	size = @entry($nr_pages)
022c9c
 }
022c9c
 
022c9c
+
022c9c
+/* newer style */
022c9c
+probe vfs.__add_to_page_cache =
022c9c
+	kernel.function("add_to_page_cache_locked"),
022c9c
+	kernel.function("add_to_page_cache_lru")
022c9c
+     { }
022c9c
+
022c9c
 probe vfs.add_to_page_cache =
022c9c
-	kernel.function("add_to_page_cache_locked") !,
022c9c
-	kernel.function("add_to_page_cache")
022c9c
+	vfs.__add_to_page_cache !,
022c9c
+	kernel.function("add_to_page_cache")  /* older style */
022c9c
 {
022c9c
 	dev = $mapping->host->i_sb->s_dev
022c9c
 	devname = __find_bdevname(dev, $mapping->host->i_sb->s_bdev)
022c9c
@@ -925,9 +932,16 @@ probe vfs.add_to_page_cache =
022c9c
 	argstr = sprintf("%d, %d", ino, $offset)
022c9c
 }
022c9c
 
022c9c
+
022c9c
+/* newer style */
022c9c
+probe vfs.__add_to_page_cache.return =
022c9c
+	kernel.function("add_to_page_cache_locked").return,
022c9c
+	kernel.function("add_to_page_cache_lru").return
022c9c
+     { }
022c9c
+
022c9c
 probe vfs.add_to_page_cache.return =
022c9c
-	kernel.function("add_to_page_cache_locked").return !,
022c9c
-	kernel.function("add_to_page_cache").return
022c9c
+	vfs.__add_to_page_cache.return !,
022c9c
+	kernel.function("add_to_page_cache").return  /* older style */
022c9c
 {
022c9c
 	name = "vfs.add_to_page_cache"
022c9c
 	retstr = sprintf("%d", $return)
022c9c
diff --git a/testsuite/semok/vfs_add_to_page_cache.stp b/testsuite/semok/vfs_add_to_page_cache.stp
022c9c
new file mode 100755
022c9c
index 0000000..5edea75
022c9c
--- /dev/null
022c9c
+++ b/testsuite/semok/vfs_add_to_page_cache.stp
022c9c
@@ -0,0 +1,4 @@
022c9c
+#! stap -p2
022c9c
+
022c9c
+probe vfs.add_to_page_cache { println(name, argstr) }
022c9c
+probe vfs.add_to_page_cache.return { println(name, retstr) }