do_readahead() requires a_ops->readpage to be != NULL:
568 static ssize_t
569 do_readahead(struct address_space *mapping, struct file *filp,
570              pgoff_t index, unsigned long nr)
571 {
572         if (!mapping || !mapping->a_ops || !mapping->a_ops->readpage)
573                 return -EINVAL;
574
575         force_page_cache_readahead(mapping, filp, index, nr);
576         return 0;
577 }

but following commit removed readpage from hugetlbfs:
    commit f2deae9d4e70793568ef9e85d227abb7bef5b622
    Author: Mel Gorman <m...@csn.ul.ie>
    Date:   Wed May 13 15:56:10 2009 +0100
        Remove implementation of readpage from the hugetlbfs_aops

So this is going to always return EINVAL on patched kernels.
Ignore return value, regardless of readahead() outcome testcase
will still check if reservation counter gets corrupted.

Signed-off-by: Jan Stancek <jstan...@redhat.com>
---
 tests/readahead_reserve.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/tests/readahead_reserve.c b/tests/readahead_reserve.c
index d0a478b..068b6f4 100644
--- a/tests/readahead_reserve.c
+++ b/tests/readahead_reserve.c
@@ -64,8 +64,7 @@ int main(int argc, char *argv[])
        verbose_printf("Reserve count after map: %lu\n", map_rsvd);
 
        /* readahead the region and record reservations */
-       if (readahead(fd, 0, hpage_size) == -1)
-               FAIL("readahead(): %s", strerror(errno));
+       readahead(fd, 0, hpage_size);
        readahead_rsvd = get_huge_page_counter(hpage_size, HUGEPAGES_RSVD);
        verbose_printf("Reserve count after readahead: %lu\n", readahead_rsvd);
 
-- 
1.7.1


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Libhugetlbfs-devel mailing list
Libhugetlbfs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to