* [PATCH 0/7] Convert to filemap_get_folios_contig()
@ 2022-08-15 18:54 Vishal Moola (Oracle)
2022-08-15 18:54 ` [PATCH 1/7] filemap: Add filemap_get_folios_contig() Vishal Moola (Oracle)
` (7 more replies)
0 siblings, 8 replies; 14+ messages in thread
From: Vishal Moola (Oracle) @ 2022-08-15 18:54 UTC (permalink / raw)
To: linux-fsdevel
Cc: linux-btrfs, linux-nilfs, linux-mm, linux-kernel, Vishal Moola (Oracle)
This patch series replaces find_get_pages_contig() with
filemap_get_folios_contig(). I've run xfstests on btrfs. I've also
tested the ramfs changes. I ran some xfstests on nilfs2, and its
seemingly fine although more testing may be beneficial.
Vishal Moola (Oracle) (7):
filemap: Add filemap_get_folios_contig()
btrfs: Convert __process_pages_contig() to use
filemap_get_folios_contig()
btrfs: Convert end_compressed_writeback() to use filemap_get_folios()
btrfs: Convert process_page_range() to use filemap_get_folios_contig()
nilfs2: Convert nilfs_find_uncommited_extent() to use
filemap_get_folios_contig()
ramfs: Convert ramfs_nommu_get_unmapped_area() to use
filemap_get_folios_contig()
filemap: Remove find_get_pages_contig()
fs/btrfs/compression.c | 26 ++++++------
fs/btrfs/extent_io.c | 33 +++++++--------
fs/btrfs/subpage.c | 2 +-
fs/btrfs/tests/extent-io-tests.c | 31 +++++++-------
fs/nilfs2/page.c | 38 ++++++++---------
fs/ramfs/file-nommu.c | 50 ++++++++++++----------
include/linux/pagemap.h | 4 +-
mm/filemap.c | 71 +++++++++++++++++++-------------
8 files changed, 134 insertions(+), 121 deletions(-)
--
2.36.1
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 1/7] filemap: Add filemap_get_folios_contig()
2022-08-15 18:54 [PATCH 0/7] Convert to filemap_get_folios_contig() Vishal Moola (Oracle)
@ 2022-08-15 18:54 ` Vishal Moola (Oracle)
2022-08-15 18:54 ` [PATCH 2/7] btrfs: Convert __process_pages_contig() to use filemap_get_folios_contig() Vishal Moola (Oracle)
` (6 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: Vishal Moola (Oracle) @ 2022-08-15 18:54 UTC (permalink / raw)
To: linux-fsdevel
Cc: linux-btrfs, linux-nilfs, linux-mm, linux-kernel, Vishal Moola (Oracle)
This function is meant to replace find_get_pages_contig().
Unlike find_get_pages_contig(), filemap_get_folios_contig() no
longer takes in a target number of pages to find - It returns up to 15
contiguous folios.
To be more consistent with filemap_get_folios(), filemap_get_folios_contig()
now also updates the start index passed in, and takes an end index.
Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
---
include/linux/pagemap.h | 2 ++
mm/filemap.c | 73 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 75 insertions(+)
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 0178b2040ea3..8689c32d628b 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -718,6 +718,8 @@ static inline struct page *find_subpage(struct page *head, pgoff_t index)
unsigned filemap_get_folios(struct address_space *mapping, pgoff_t *start,
pgoff_t end, struct folio_batch *fbatch);
+unsigned filemap_get_folios_contig(struct address_space *mapping,
+ pgoff_t *start, pgoff_t end, struct folio_batch *fbatch);
unsigned find_get_pages_contig(struct address_space *mapping, pgoff_t start,
unsigned int nr_pages, struct page **pages);
unsigned find_get_pages_range_tag(struct address_space *mapping, pgoff_t *index,
diff --git a/mm/filemap.c b/mm/filemap.c
index 15800334147b..3a497e178fde 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2194,6 +2194,79 @@ bool folio_more_pages(struct folio *folio, pgoff_t index, pgoff_t max)
return index < folio->index + folio_nr_pages(folio) - 1;
}
+/**
+ * filemap_get_folios_contig - Get a batch of contiguous folios
+ * @mapping: The address_space to search
+ * @start: The starting page index
+ * @end: The final page index (inclusive)
+ * @fbatch: The batch to fill
+ *
+ * filemap_get_folios_contig() works exactly like filemap_get_folios(),
+ * except the returned folios are guaranteed to be contiguous. This may
+ * not return all contiguous folios if the batch gets filled up.
+ *
+ * Return: The number of folios found.
+ * Also update @start to be positioned for traversal of the next folio.
+ */
+
+unsigned filemap_get_folios_contig(struct address_space *mapping,
+ pgoff_t *start, pgoff_t end, struct folio_batch *fbatch)
+{
+ XA_STATE(xas, &mapping->i_pages, *start);
+ unsigned long nr;
+ struct folio *folio;
+
+ rcu_read_lock();
+
+ for (folio = xas_load(&xas); folio && xas.xa_index <= end;
+ folio = xas_next(&xas)) {
+ if (xas_retry(&xas, folio))
+ continue;
+ /*
+ * If the entry has been swapped out, we can stop looking.
+ * No current caller is looking for DAX entries.
+ */
+ if (xa_is_value(folio))
+ goto update_start;
+
+ if (!folio_try_get_rcu(folio))
+ goto retry;
+
+ if (unlikely(folio != xas_reload(&xas)))
+ goto put_folio;
+
+ if (!folio_batch_add(fbatch, folio)) {
+ nr = folio_nr_pages(folio);
+
+ if (folio_test_hugetlb(folio))
+ nr = 1;
+ *start = folio->index + nr;
+ goto out;
+ }
+ continue;
+put_folio:
+ folio_put(folio);
+
+retry:
+ xas_reset(&xas);
+ }
+
+update_start:
+ nr = folio_batch_count(fbatch);
+
+ if (nr) {
+ folio = fbatch->folios[nr - 1];
+ if (folio_test_hugetlb(folio))
+ *start = folio->index + 1;
+ else
+ *start = folio->index + folio_nr_pages(folio);
+ }
+out:
+ rcu_read_unlock();
+ return folio_batch_count(fbatch);
+}
+EXPORT_SYMBOL(filemap_get_folios_contig);
+
/**
* find_get_pages_contig - gang contiguous pagecache lookup
* @mapping: The address_space to search
--
2.36.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 2/7] btrfs: Convert __process_pages_contig() to use filemap_get_folios_contig()
2022-08-15 18:54 [PATCH 0/7] Convert to filemap_get_folios_contig() Vishal Moola (Oracle)
2022-08-15 18:54 ` [PATCH 1/7] filemap: Add filemap_get_folios_contig() Vishal Moola (Oracle)
@ 2022-08-15 18:54 ` Vishal Moola (Oracle)
2022-08-15 18:54 ` [PATCH 3/7] btrfs: Convert end_compressed_writeback() to use filemap_get_folios() Vishal Moola (Oracle)
` (5 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: Vishal Moola (Oracle) @ 2022-08-15 18:54 UTC (permalink / raw)
To: linux-fsdevel
Cc: linux-btrfs, linux-nilfs, linux-mm, linux-kernel, Vishal Moola (Oracle)
Convert to use folios throughout. This is in preparation for the removal of
find_get_pages_contig(). Now also supports large folios.
Since we may receive more than nr_pages pages, nr_pages may underflow.
Since nr_pages > 0 is equivalent to index <= end_index, we replaced it
with this check instead.
Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
---
fs/btrfs/extent_io.c | 33 +++++++++++++++------------------
1 file changed, 15 insertions(+), 18 deletions(-)
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index bfae67c593c5..2c2f0e281014 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -1900,9 +1900,8 @@ static int __process_pages_contig(struct address_space *mapping,
pgoff_t start_index = start >> PAGE_SHIFT;
pgoff_t end_index = end >> PAGE_SHIFT;
pgoff_t index = start_index;
- unsigned long nr_pages = end_index - start_index + 1;
unsigned long pages_processed = 0;
- struct page *pages[16];
+ struct folio_batch fbatch;
int err = 0;
int i;
@@ -1911,16 +1910,17 @@ static int __process_pages_contig(struct address_space *mapping,
ASSERT(processed_end && *processed_end == start);
}
- if ((page_ops & PAGE_SET_ERROR) && nr_pages > 0)
+ if ((page_ops & PAGE_SET_ERROR) && start_index <= end_index)
mapping_set_error(mapping, -EIO);
- while (nr_pages > 0) {
- int found_pages;
+ folio_batch_init(&fbatch);
+ while (index <= end_index) {
+ int found_folios;
+
+ found_folios = filemap_get_folios_contig(mapping, &index,
+ end_index, &fbatch);
- found_pages = find_get_pages_contig(mapping, index,
- min_t(unsigned long,
- nr_pages, ARRAY_SIZE(pages)), pages);
- if (found_pages == 0) {
+ if (found_folios == 0) {
/*
* Only if we're going to lock these pages, we can find
* nothing at @index.
@@ -1930,23 +1930,20 @@ static int __process_pages_contig(struct address_space *mapping,
goto out;
}
- for (i = 0; i < found_pages; i++) {
+ for (i = 0; i < found_folios; i++) {
int process_ret;
-
+ struct folio *folio = fbatch.folios[i];
process_ret = process_one_page(fs_info, mapping,
- pages[i], locked_page, page_ops,
+ &folio->page, locked_page, page_ops,
start, end);
if (process_ret < 0) {
- for (; i < found_pages; i++)
- put_page(pages[i]);
err = -EAGAIN;
+ folio_batch_release(&fbatch);
goto out;
}
- put_page(pages[i]);
- pages_processed++;
+ pages_processed += folio_nr_pages(folio);
}
- nr_pages -= found_pages;
- index += found_pages;
+ folio_batch_release(&fbatch);
cond_resched();
}
out:
--
2.36.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 3/7] btrfs: Convert end_compressed_writeback() to use filemap_get_folios()
2022-08-15 18:54 [PATCH 0/7] Convert to filemap_get_folios_contig() Vishal Moola (Oracle)
2022-08-15 18:54 ` [PATCH 1/7] filemap: Add filemap_get_folios_contig() Vishal Moola (Oracle)
2022-08-15 18:54 ` [PATCH 2/7] btrfs: Convert __process_pages_contig() to use filemap_get_folios_contig() Vishal Moola (Oracle)
@ 2022-08-15 18:54 ` Vishal Moola (Oracle)
2022-08-15 18:54 ` [PATCH 4/7] btrfs: Convert process_page_range() to use filemap_get_folios_contig() Vishal Moola (Oracle)
` (4 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: Vishal Moola (Oracle) @ 2022-08-15 18:54 UTC (permalink / raw)
To: linux-fsdevel
Cc: linux-btrfs, linux-nilfs, linux-mm, linux-kernel, Vishal Moola (Oracle)
Converted function to use folios throughout. This is in preparation for
the removal of find_get_pages_contig(). Now also supports large folios.
Since we may receive more than nr_pages pages, nr_pages may underflow.
Since nr_pages > 0 is equivalent to index <= end_index, we replaced it
with this check instead.
Also this function does not care about the pages being contiguous so we
can just use filemap_get_folios() to be more efficient.
Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
---
fs/btrfs/compression.c | 26 ++++++++++++--------------
1 file changed, 12 insertions(+), 14 deletions(-)
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index e84d22c5c6a8..d4ebef60b3ce 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -8,6 +8,7 @@
#include <linux/file.h>
#include <linux/fs.h>
#include <linux/pagemap.h>
+#include <linux/pagevec.h>
#include <linux/highmem.h>
#include <linux/kthread.h>
#include <linux/time.h>
@@ -222,8 +223,7 @@ static noinline void end_compressed_writeback(struct inode *inode,
struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
unsigned long index = cb->start >> PAGE_SHIFT;
unsigned long end_index = (cb->start + cb->len - 1) >> PAGE_SHIFT;
- struct page *pages[16];
- unsigned long nr_pages = end_index - index + 1;
+ struct folio_batch fbatch;
const int errno = blk_status_to_errno(cb->status);
int i;
int ret;
@@ -231,24 +231,22 @@ static noinline void end_compressed_writeback(struct inode *inode,
if (errno)
mapping_set_error(inode->i_mapping, errno);
- while (nr_pages > 0) {
- ret = find_get_pages_contig(inode->i_mapping, index,
- min_t(unsigned long,
- nr_pages, ARRAY_SIZE(pages)), pages);
+ folio_batch_init(&fbatch);
+ while (index <= end_index) {
+ ret = filemap_get_folios(inode->i_mapping, &index, end_index,
+ &fbatch);
+
if (ret == 0) {
- nr_pages -= 1;
- index += 1;
- continue;
+ return;
}
for (i = 0; i < ret; i++) {
+ struct folio *folio = fbatch.folios[i];
if (errno)
- SetPageError(pages[i]);
- btrfs_page_clamp_clear_writeback(fs_info, pages[i],
+ folio_set_error(folio);
+ btrfs_page_clamp_clear_writeback(fs_info, &folio->page,
cb->start, cb->len);
- put_page(pages[i]);
}
- nr_pages -= ret;
- index += ret;
+ folio_batch_release(&fbatch);
}
/* the inode may be gone now */
}
--
2.36.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 4/7] btrfs: Convert process_page_range() to use filemap_get_folios_contig()
2022-08-15 18:54 [PATCH 0/7] Convert to filemap_get_folios_contig() Vishal Moola (Oracle)
` (2 preceding siblings ...)
2022-08-15 18:54 ` [PATCH 3/7] btrfs: Convert end_compressed_writeback() to use filemap_get_folios() Vishal Moola (Oracle)
@ 2022-08-15 18:54 ` Vishal Moola (Oracle)
2022-08-15 18:54 ` [PATCH 5/7] nilfs2: Convert nilfs_find_uncommited_extent() " Vishal Moola (Oracle)
` (3 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: Vishal Moola (Oracle) @ 2022-08-15 18:54 UTC (permalink / raw)
To: linux-fsdevel
Cc: linux-btrfs, linux-nilfs, linux-mm, linux-kernel, Vishal Moola (Oracle)
Converted function to use folios throughout. This is in preparation for
the removal of find_get_pages_contig(). Now also supports large folios.
Since we may receive more than nr_pages pages, nr_pages may underflow.
Since nr_pages > 0 is equivalent to index <= end_index, we replaced it
with this check instead.
Also minor comment renaming for consistency in subpage.
Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
---
fs/btrfs/subpage.c | 2 +-
fs/btrfs/tests/extent-io-tests.c | 31 ++++++++++++++++---------------
2 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/fs/btrfs/subpage.c b/fs/btrfs/subpage.c
index 6fc2b77ae5c3..9a176af847d7 100644
--- a/fs/btrfs/subpage.c
+++ b/fs/btrfs/subpage.c
@@ -337,7 +337,7 @@ bool btrfs_subpage_end_and_test_writer(const struct btrfs_fs_info *fs_info,
*
* Even with 0 returned, the page still need extra check to make sure
* it's really the correct page, as the caller is using
- * find_get_pages_contig(), which can race with page invalidating.
+ * filemap_get_folios_contig(), which can race with page invalidating.
*/
int btrfs_page_start_writer_lock(const struct btrfs_fs_info *fs_info,
struct page *page, u64 start, u32 len)
diff --git a/fs/btrfs/tests/extent-io-tests.c b/fs/btrfs/tests/extent-io-tests.c
index a232b15b8021..530073868916 100644
--- a/fs/btrfs/tests/extent-io-tests.c
+++ b/fs/btrfs/tests/extent-io-tests.c
@@ -4,6 +4,7 @@
*/
#include <linux/pagemap.h>
+#include <linux/pagevec.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/sizes.h>
@@ -20,39 +21,39 @@ static noinline int process_page_range(struct inode *inode, u64 start, u64 end,
unsigned long flags)
{
int ret;
- struct page *pages[16];
+ struct folio_batch fbatch;
unsigned long index = start >> PAGE_SHIFT;
unsigned long end_index = end >> PAGE_SHIFT;
- unsigned long nr_pages = end_index - index + 1;
int i;
int count = 0;
int loops = 0;
- while (nr_pages > 0) {
- ret = find_get_pages_contig(inode->i_mapping, index,
- min_t(unsigned long, nr_pages,
- ARRAY_SIZE(pages)), pages);
+ folio_batch_init(&fbatch);
+
+ while (index <= end_index) {
+ ret = filemap_get_folios_contig(inode->i_mapping, &index,
+ end_index, &fbatch);
for (i = 0; i < ret; i++) {
+ struct folio *folio = fbatch.folios[i];
if (flags & PROCESS_TEST_LOCKED &&
- !PageLocked(pages[i]))
+ !folio_test_locked(folio))
count++;
- if (flags & PROCESS_UNLOCK && PageLocked(pages[i]))
- unlock_page(pages[i]);
- put_page(pages[i]);
+ if (flags & PROCESS_UNLOCK && folio_test_locked(folio))
+ folio_unlock(folio);
if (flags & PROCESS_RELEASE)
- put_page(pages[i]);
+ folio_put(folio);
}
- nr_pages -= ret;
- index += ret;
+ folio_batch_release(&fbatch);
cond_resched();
loops++;
if (loops > 100000) {
printk(KERN_ERR
- "stuck in a loop, start %llu, end %llu, nr_pages %lu, ret %d\n",
- start, end, nr_pages, ret);
+ "stuck in a loop, start %llu, end %llu, ret %d\n",
+ start, end, ret);
break;
}
}
+
return count;
}
--
2.36.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 5/7] nilfs2: Convert nilfs_find_uncommited_extent() to use filemap_get_folios_contig()
2022-08-15 18:54 [PATCH 0/7] Convert to filemap_get_folios_contig() Vishal Moola (Oracle)
` (3 preceding siblings ...)
2022-08-15 18:54 ` [PATCH 4/7] btrfs: Convert process_page_range() to use filemap_get_folios_contig() Vishal Moola (Oracle)
@ 2022-08-15 18:54 ` Vishal Moola (Oracle)
2022-08-15 23:34 ` kernel test robot
2022-08-16 2:47 ` kernel test robot
2022-08-15 18:54 ` [PATCH 6/7] ramfs: Convert ramfs_nommu_get_unmapped_area() " Vishal Moola (Oracle)
` (2 subsequent siblings)
7 siblings, 2 replies; 14+ messages in thread
From: Vishal Moola (Oracle) @ 2022-08-15 18:54 UTC (permalink / raw)
To: linux-fsdevel
Cc: linux-btrfs, linux-nilfs, linux-mm, linux-kernel, Vishal Moola (Oracle)
Converted function to use folios throughout. This is in preparation for
the removal of find_get_pages_contig(). Now also supports large folios.
Also cleaned up an unnecessary if statement - pvec.pages[0]->index > index
will always evaluate to false, and filemap_get_folios_contig() returns 0 if
there is no folio found at index.
Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
---
fs/nilfs2/page.c | 38 +++++++++++++++++---------------------
1 file changed, 17 insertions(+), 21 deletions(-)
diff --git a/fs/nilfs2/page.c b/fs/nilfs2/page.c
index 3267e96c256c..40cc8eb0bc8e 100644
--- a/fs/nilfs2/page.c
+++ b/fs/nilfs2/page.c
@@ -480,13 +480,13 @@ unsigned long nilfs_find_uncommitted_extent(struct inode *inode,
sector_t start_blk,
sector_t *blkoff)
{
- unsigned int i;
+ unsigned int i, nr;
pgoff_t index;
unsigned int nblocks_in_page;
unsigned long length = 0;
sector_t b;
- struct pagevec pvec;
- struct page *page;
+ struct folio_batch fbatch;
+ struct folio *folio;
if (inode->i_mapping->nrpages == 0)
return 0;
@@ -494,27 +494,24 @@ unsigned long nilfs_find_uncommitted_extent(struct inode *inode,
index = start_blk >> (PAGE_SHIFT - inode->i_blkbits);
nblocks_in_page = 1U << (PAGE_SHIFT - inode->i_blkbits);
- pagevec_init(&pvec);
+ folio_batch_init(&fbatch);
repeat:
- pvec.nr = find_get_pages_contig(inode->i_mapping, index, PAGEVEC_SIZE,
- pvec.pages);
- if (pvec.nr == 0)
+ nr = filemap_get_folios_contig(inode->i_mapping, &index, ULONG_MAX,
+ &fbatch);
+ if (nr == 0)
return length;
- if (length > 0 && pvec.pages[0]->index > index)
- goto out;
-
- b = pvec.pages[0]->index << (PAGE_SHIFT - inode->i_blkbits);
+ b = fbatch.folios[0]->index << (PAGE_SHIFT - inode->i_blkbits);
i = 0;
do {
- page = pvec.pages[i];
+ folio = fbatch.folios[i];
- lock_page(page);
- if (page_has_buffers(page)) {
+ folio_lock(folio);
+ if (folio_buffers(folio)) {
struct buffer_head *bh, *head;
- bh = head = page_buffers(page);
+ bh = head = folio_buffers(folio);
do {
if (b < start_blk)
continue;
@@ -532,18 +529,17 @@ unsigned long nilfs_find_uncommitted_extent(struct inode *inode,
b += nblocks_in_page;
}
- unlock_page(page);
+ folio_unlock(folio);
- } while (++i < pagevec_count(&pvec));
+ } while (++i < nr);
- index = page->index + 1;
- pagevec_release(&pvec);
+ folio_batch_release(&fbatch);
cond_resched();
goto repeat;
out_locked:
- unlock_page(page);
+ folio_unlock(folio);
out:
- pagevec_release(&pvec);
+ folio_batch_release(&fbatch);
return length;
}
--
2.36.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 6/7] ramfs: Convert ramfs_nommu_get_unmapped_area() to use filemap_get_folios_contig()
2022-08-15 18:54 [PATCH 0/7] Convert to filemap_get_folios_contig() Vishal Moola (Oracle)
` (4 preceding siblings ...)
2022-08-15 18:54 ` [PATCH 5/7] nilfs2: Convert nilfs_find_uncommited_extent() " Vishal Moola (Oracle)
@ 2022-08-15 18:54 ` Vishal Moola (Oracle)
2022-08-15 18:54 ` Vishal Moola (Oracle)
2022-08-15 20:17 ` [PATCH 0/7] Convert to filemap_get_folios_contig() Matthew Wilcox
7 siblings, 0 replies; 14+ messages in thread
From: Vishal Moola (Oracle) @ 2022-08-15 18:54 UTC (permalink / raw)
To: linux-fsdevel
Cc: linux-btrfs, linux-nilfs, linux-mm, linux-kernel, Vishal Moola (Oracle)
Converted to use folios throughout. This is in preparation for the
removal for find_get_pages_contig(). Now also supports large folios.
The initial version of this function set the page_address to be returned
after finishing all the checks. Since folio_batches have a maximum of 15
folios, the function had to be modified to support getting and checking up
to lpages, 15 pages at a time while still returning the initial page address.
Now the function sets ret as soon as the first batch arrives, and updates it
only if a check fails.
The physical adjacency check utilizes the page frame numbers. The page frame
number of each folio must be nr_pages away from the first folio.
Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
---
fs/ramfs/file-nommu.c | 50 +++++++++++++++++++++++++------------------
1 file changed, 29 insertions(+), 21 deletions(-)
diff --git a/fs/ramfs/file-nommu.c b/fs/ramfs/file-nommu.c
index ba3525ccc27e..81817f301e17 100644
--- a/fs/ramfs/file-nommu.c
+++ b/fs/ramfs/file-nommu.c
@@ -203,9 +203,9 @@ static unsigned long ramfs_nommu_get_unmapped_area(struct file *file,
unsigned long addr, unsigned long len,
unsigned long pgoff, unsigned long flags)
{
- unsigned long maxpages, lpages, nr, loop, ret;
+ unsigned long maxpages, lpages, nr, loop, ret, nr_pages, pfn;
struct inode *inode = file_inode(file);
- struct page **pages = NULL, **ptr, *page;
+ struct folio_batch fbatch;
loff_t isize;
/* the mapping mustn't extend beyond the EOF */
@@ -221,31 +221,39 @@ static unsigned long ramfs_nommu_get_unmapped_area(struct file *file,
goto out;
/* gang-find the pages */
- pages = kcalloc(lpages, sizeof(struct page *), GFP_KERNEL);
- if (!pages)
- goto out_free;
-
- nr = find_get_pages_contig(inode->i_mapping, pgoff, lpages, pages);
- if (nr != lpages)
- goto out_free_pages; /* leave if some pages were missing */
+ folio_batch_init(&fbatch);
+ nr_pages = 0;
+repeat:
+ nr = filemap_get_folios_contig(inode->i_mapping, &pgoff,
+ ULONG_MAX, &fbatch);
+ if (!nr) {
+ ret = -ENOSYS;
+ return ret;
+ }
+ if (ret == -ENOSYS) {
+ ret = (unsigned long) folio_address(fbatch.folios[0]);
+ pfn = folio_pfn(fbatch.folios[0]);
+ }
/* check the pages for physical adjacency */
- ptr = pages;
- page = *ptr++;
- page++;
- for (loop = lpages; loop > 1; loop--)
- if (*ptr++ != page++)
- goto out_free_pages;
+ for (loop = 0; loop < nr; loop++) {
+ if (pfn + nr_pages != folio_pfn(fbatch.folios[loop])) {
+ ret = -ENOSYS;
+ goto out_free; /* leave if not physical adjacent */
+ }
+ nr_pages += folio_nr_pages(fbatch.folios[loop]);
+ if (nr_pages >= lpages)
+ goto out_free; /* successfully found desired pages*/
+ }
+ if (nr_pages < lpages) {
+ folio_batch_release(&fbatch);
+ goto repeat; /* loop if pages are missing */
+ }
/* okay - all conditions fulfilled */
- ret = (unsigned long) page_address(pages[0]);
-out_free_pages:
- ptr = pages;
- for (loop = nr; loop > 0; loop--)
- put_page(*ptr++);
out_free:
- kfree(pages);
+ folio_batch_release(&fbatch);
out:
return ret;
}
--
2.36.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 7/7] filemap: Remove find_get_pages_contig()
@ 2022-08-15 18:54 ` Vishal Moola (Oracle)
0 siblings, 0 replies; 14+ messages in thread
From: Vishal Moola (Oracle) @ 2022-08-15 18:54 UTC (permalink / raw)
To: linux-fsdevel
Cc: linux-btrfs, linux-nilfs, linux-mm, linux-kernel, Vishal Moola (Oracle)
All callers of find_get_pages_contig() have been removed, so it is no
longer needed.
Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
---
include/linux/pagemap.h | 2 --
mm/filemap.c | 60 -----------------------------------------
2 files changed, 62 deletions(-)
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 8689c32d628b..09de43e36a64 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -720,8 +720,6 @@ unsigned filemap_get_folios(struct address_space *mapping, pgoff_t *start,
pgoff_t end, struct folio_batch *fbatch);
unsigned filemap_get_folios_contig(struct address_space *mapping,
pgoff_t *start, pgoff_t end, struct folio_batch *fbatch);
-unsigned find_get_pages_contig(struct address_space *mapping, pgoff_t start,
- unsigned int nr_pages, struct page **pages);
unsigned find_get_pages_range_tag(struct address_space *mapping, pgoff_t *index,
pgoff_t end, xa_mark_t tag, unsigned int nr_pages,
struct page **pages);
diff --git a/mm/filemap.c b/mm/filemap.c
index 3a497e178fde..100f36c9247c 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2267,66 +2267,6 @@ unsigned filemap_get_folios_contig(struct address_space *mapping,
}
EXPORT_SYMBOL(filemap_get_folios_contig);
-/**
- * find_get_pages_contig - gang contiguous pagecache lookup
- * @mapping: The address_space to search
- * @index: The starting page index
- * @nr_pages: The maximum number of pages
- * @pages: Where the resulting pages are placed
- *
- * find_get_pages_contig() works exactly like find_get_pages_range(),
- * except that the returned number of pages are guaranteed to be
- * contiguous.
- *
- * Return: the number of pages which were found.
- */
-unsigned find_get_pages_contig(struct address_space *mapping, pgoff_t index,
- unsigned int nr_pages, struct page **pages)
-{
- XA_STATE(xas, &mapping->i_pages, index);
- struct folio *folio;
- unsigned int ret = 0;
-
- if (unlikely(!nr_pages))
- return 0;
-
- rcu_read_lock();
- for (folio = xas_load(&xas); folio; folio = xas_next(&xas)) {
- if (xas_retry(&xas, folio))
- continue;
- /*
- * If the entry has been swapped out, we can stop looking.
- * No current caller is looking for DAX entries.
- */
- if (xa_is_value(folio))
- break;
-
- if (!folio_try_get_rcu(folio))
- goto retry;
-
- if (unlikely(folio != xas_reload(&xas)))
- goto put_page;
-
-again:
- pages[ret] = folio_file_page(folio, xas.xa_index);
- if (++ret == nr_pages)
- break;
- if (folio_more_pages(folio, xas.xa_index, ULONG_MAX)) {
- xas.xa_index++;
- folio_ref_inc(folio);
- goto again;
- }
- continue;
-put_page:
- folio_put(folio);
-retry:
- xas_reset(&xas);
- }
- rcu_read_unlock();
- return ret;
-}
-EXPORT_SYMBOL(find_get_pages_contig);
-
/**
* find_get_pages_range_tag - Find and return head pages matching @tag.
* @mapping: the address_space to search
--
2.36.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 7/7] filemap: Remove find_get_pages_contig()
@ 2022-08-15 18:54 ` Vishal Moola (Oracle)
0 siblings, 0 replies; 14+ messages in thread
From: Vishal Moola (Oracle) @ 2022-08-15 18:54 UTC (permalink / raw)
To: linux-fsdevel-u79uwXL29TY76Z2rM5mHXA
Cc: linux-btrfs-u79uwXL29TY76Z2rM5mHXA,
linux-nilfs-u79uwXL29TY76Z2rM5mHXA,
linux-mm-Bw31MaZKKs3YtjvyW6yDsg,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, Vishal Moola (Oracle)
All callers of find_get_pages_contig() have been removed, so it is no
longer needed.
Signed-off-by: Vishal Moola (Oracle) <vishal.moola-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
include/linux/pagemap.h | 2 --
mm/filemap.c | 60 -----------------------------------------
2 files changed, 62 deletions(-)
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 8689c32d628b..09de43e36a64 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -720,8 +720,6 @@ unsigned filemap_get_folios(struct address_space *mapping, pgoff_t *start,
pgoff_t end, struct folio_batch *fbatch);
unsigned filemap_get_folios_contig(struct address_space *mapping,
pgoff_t *start, pgoff_t end, struct folio_batch *fbatch);
-unsigned find_get_pages_contig(struct address_space *mapping, pgoff_t start,
- unsigned int nr_pages, struct page **pages);
unsigned find_get_pages_range_tag(struct address_space *mapping, pgoff_t *index,
pgoff_t end, xa_mark_t tag, unsigned int nr_pages,
struct page **pages);
diff --git a/mm/filemap.c b/mm/filemap.c
index 3a497e178fde..100f36c9247c 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2267,66 +2267,6 @@ unsigned filemap_get_folios_contig(struct address_space *mapping,
}
EXPORT_SYMBOL(filemap_get_folios_contig);
-/**
- * find_get_pages_contig - gang contiguous pagecache lookup
- * @mapping: The address_space to search
- * @index: The starting page index
- * @nr_pages: The maximum number of pages
- * @pages: Where the resulting pages are placed
- *
- * find_get_pages_contig() works exactly like find_get_pages_range(),
- * except that the returned number of pages are guaranteed to be
- * contiguous.
- *
- * Return: the number of pages which were found.
- */
-unsigned find_get_pages_contig(struct address_space *mapping, pgoff_t index,
- unsigned int nr_pages, struct page **pages)
-{
- XA_STATE(xas, &mapping->i_pages, index);
- struct folio *folio;
- unsigned int ret = 0;
-
- if (unlikely(!nr_pages))
- return 0;
-
- rcu_read_lock();
- for (folio = xas_load(&xas); folio; folio = xas_next(&xas)) {
- if (xas_retry(&xas, folio))
- continue;
- /*
- * If the entry has been swapped out, we can stop looking.
- * No current caller is looking for DAX entries.
- */
- if (xa_is_value(folio))
- break;
-
- if (!folio_try_get_rcu(folio))
- goto retry;
-
- if (unlikely(folio != xas_reload(&xas)))
- goto put_page;
-
-again:
- pages[ret] = folio_file_page(folio, xas.xa_index);
- if (++ret == nr_pages)
- break;
- if (folio_more_pages(folio, xas.xa_index, ULONG_MAX)) {
- xas.xa_index++;
- folio_ref_inc(folio);
- goto again;
- }
- continue;
-put_page:
- folio_put(folio);
-retry:
- xas_reset(&xas);
- }
- rcu_read_unlock();
- return ret;
-}
-EXPORT_SYMBOL(find_get_pages_contig);
-
/**
* find_get_pages_range_tag - Find and return head pages matching @tag.
* @mapping: the address_space to search
--
2.36.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 0/7] Convert to filemap_get_folios_contig()
2022-08-15 18:54 [PATCH 0/7] Convert to filemap_get_folios_contig() Vishal Moola (Oracle)
` (6 preceding siblings ...)
2022-08-15 18:54 ` Vishal Moola (Oracle)
@ 2022-08-15 20:17 ` Matthew Wilcox
7 siblings, 0 replies; 14+ messages in thread
From: Matthew Wilcox @ 2022-08-15 20:17 UTC (permalink / raw)
To: Vishal Moola (Oracle)
Cc: linux-fsdevel, linux-btrfs, linux-nilfs, linux-mm, linux-kernel
On Mon, Aug 15, 2022 at 11:54:45AM -0700, Vishal Moola (Oracle) wrote:
> This patch series replaces find_get_pages_contig() with
> filemap_get_folios_contig(). I've run xfstests on btrfs. I've also
> tested the ramfs changes. I ran some xfstests on nilfs2, and its
> seemingly fine although more testing may be beneficial.
These all look good to me. I'd like to see R-b tags from the various
fs maintainers, but I intend to add this series to the folio tree for
merging in 6.1.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 5/7] nilfs2: Convert nilfs_find_uncommited_extent() to use filemap_get_folios_contig()
2022-08-15 18:54 ` [PATCH 5/7] nilfs2: Convert nilfs_find_uncommited_extent() " Vishal Moola (Oracle)
@ 2022-08-15 23:34 ` kernel test robot
2022-08-16 2:47 ` kernel test robot
1 sibling, 0 replies; 14+ messages in thread
From: kernel test robot @ 2022-08-15 23:34 UTC (permalink / raw)
To: Vishal Moola (Oracle), linux-fsdevel
Cc: kbuild-all, linux-btrfs, linux-nilfs, linux-mm, linux-kernel,
Vishal Moola (Oracle)
Hi "Vishal,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v6.0-rc1 next-20220815]
[cannot apply to kdave/for-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Vishal-Moola-Oracle/Convert-to-filemap_get_folios_contig/20220816-025830
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 568035b01cfb107af8d2e4bd2fb9aea22cf5b868
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20220816/202208160738.yErltyXd-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-5) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/ce1966344933bbe10010035cd25f23ec7dd76914
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Vishal-Moola-Oracle/Convert-to-filemap_get_folios_contig/20220816-025830
git checkout ce1966344933bbe10010035cd25f23ec7dd76914
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash fs/nilfs2/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
fs/nilfs2/page.c: In function 'nilfs_find_uncommitted_extent':
>> fs/nilfs2/page.c:542:1: warning: label 'out' defined but not used [-Wunused-label]
542 | out:
| ^~~
vim +/out +542 fs/nilfs2/page.c
622daaff0a8975 Ryusuke Konishi 2010-12-26 466
622daaff0a8975 Ryusuke Konishi 2010-12-26 467 /**
622daaff0a8975 Ryusuke Konishi 2010-12-26 468 * nilfs_find_uncommitted_extent - find extent of uncommitted data
622daaff0a8975 Ryusuke Konishi 2010-12-26 469 * @inode: inode
622daaff0a8975 Ryusuke Konishi 2010-12-26 470 * @start_blk: start block offset (in)
622daaff0a8975 Ryusuke Konishi 2010-12-26 471 * @blkoff: start offset of the found extent (out)
622daaff0a8975 Ryusuke Konishi 2010-12-26 472 *
622daaff0a8975 Ryusuke Konishi 2010-12-26 473 * This function searches an extent of buffers marked "delayed" which
622daaff0a8975 Ryusuke Konishi 2010-12-26 474 * starts from a block offset equal to or larger than @start_blk. If
622daaff0a8975 Ryusuke Konishi 2010-12-26 475 * such an extent was found, this will store the start offset in
622daaff0a8975 Ryusuke Konishi 2010-12-26 476 * @blkoff and return its length in blocks. Otherwise, zero is
622daaff0a8975 Ryusuke Konishi 2010-12-26 477 * returned.
622daaff0a8975 Ryusuke Konishi 2010-12-26 478 */
622daaff0a8975 Ryusuke Konishi 2010-12-26 479 unsigned long nilfs_find_uncommitted_extent(struct inode *inode,
622daaff0a8975 Ryusuke Konishi 2010-12-26 480 sector_t start_blk,
622daaff0a8975 Ryusuke Konishi 2010-12-26 481 sector_t *blkoff)
622daaff0a8975 Ryusuke Konishi 2010-12-26 482 {
ce1966344933bb Vishal Moola (Oracle 2022-08-15 483) unsigned int i, nr;
622daaff0a8975 Ryusuke Konishi 2010-12-26 484 pgoff_t index;
622daaff0a8975 Ryusuke Konishi 2010-12-26 485 unsigned int nblocks_in_page;
622daaff0a8975 Ryusuke Konishi 2010-12-26 486 unsigned long length = 0;
622daaff0a8975 Ryusuke Konishi 2010-12-26 487 sector_t b;
ce1966344933bb Vishal Moola (Oracle 2022-08-15 488) struct folio_batch fbatch;
ce1966344933bb Vishal Moola (Oracle 2022-08-15 489) struct folio *folio;
622daaff0a8975 Ryusuke Konishi 2010-12-26 490
622daaff0a8975 Ryusuke Konishi 2010-12-26 491 if (inode->i_mapping->nrpages == 0)
622daaff0a8975 Ryusuke Konishi 2010-12-26 492 return 0;
622daaff0a8975 Ryusuke Konishi 2010-12-26 493
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01 494 index = start_blk >> (PAGE_SHIFT - inode->i_blkbits);
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01 495 nblocks_in_page = 1U << (PAGE_SHIFT - inode->i_blkbits);
622daaff0a8975 Ryusuke Konishi 2010-12-26 496
ce1966344933bb Vishal Moola (Oracle 2022-08-15 497) folio_batch_init(&fbatch);
622daaff0a8975 Ryusuke Konishi 2010-12-26 498
622daaff0a8975 Ryusuke Konishi 2010-12-26 499 repeat:
ce1966344933bb Vishal Moola (Oracle 2022-08-15 500) nr = filemap_get_folios_contig(inode->i_mapping, &index, ULONG_MAX,
ce1966344933bb Vishal Moola (Oracle 2022-08-15 501) &fbatch);
ce1966344933bb Vishal Moola (Oracle 2022-08-15 502) if (nr == 0)
622daaff0a8975 Ryusuke Konishi 2010-12-26 503 return length;
622daaff0a8975 Ryusuke Konishi 2010-12-26 504
ce1966344933bb Vishal Moola (Oracle 2022-08-15 505) b = fbatch.folios[0]->index << (PAGE_SHIFT - inode->i_blkbits);
622daaff0a8975 Ryusuke Konishi 2010-12-26 506 i = 0;
622daaff0a8975 Ryusuke Konishi 2010-12-26 507 do {
ce1966344933bb Vishal Moola (Oracle 2022-08-15 508) folio = fbatch.folios[i];
622daaff0a8975 Ryusuke Konishi 2010-12-26 509
ce1966344933bb Vishal Moola (Oracle 2022-08-15 510) folio_lock(folio);
ce1966344933bb Vishal Moola (Oracle 2022-08-15 511) if (folio_buffers(folio)) {
622daaff0a8975 Ryusuke Konishi 2010-12-26 512 struct buffer_head *bh, *head;
622daaff0a8975 Ryusuke Konishi 2010-12-26 513
ce1966344933bb Vishal Moola (Oracle 2022-08-15 514) bh = head = folio_buffers(folio);
622daaff0a8975 Ryusuke Konishi 2010-12-26 515 do {
622daaff0a8975 Ryusuke Konishi 2010-12-26 516 if (b < start_blk)
622daaff0a8975 Ryusuke Konishi 2010-12-26 517 continue;
622daaff0a8975 Ryusuke Konishi 2010-12-26 518 if (buffer_delay(bh)) {
622daaff0a8975 Ryusuke Konishi 2010-12-26 519 if (length == 0)
622daaff0a8975 Ryusuke Konishi 2010-12-26 520 *blkoff = b;
622daaff0a8975 Ryusuke Konishi 2010-12-26 521 length++;
622daaff0a8975 Ryusuke Konishi 2010-12-26 522 } else if (length > 0) {
622daaff0a8975 Ryusuke Konishi 2010-12-26 523 goto out_locked;
622daaff0a8975 Ryusuke Konishi 2010-12-26 524 }
622daaff0a8975 Ryusuke Konishi 2010-12-26 525 } while (++b, bh = bh->b_this_page, bh != head);
622daaff0a8975 Ryusuke Konishi 2010-12-26 526 } else {
622daaff0a8975 Ryusuke Konishi 2010-12-26 527 if (length > 0)
622daaff0a8975 Ryusuke Konishi 2010-12-26 528 goto out_locked;
622daaff0a8975 Ryusuke Konishi 2010-12-26 529
622daaff0a8975 Ryusuke Konishi 2010-12-26 530 b += nblocks_in_page;
622daaff0a8975 Ryusuke Konishi 2010-12-26 531 }
ce1966344933bb Vishal Moola (Oracle 2022-08-15 532) folio_unlock(folio);
622daaff0a8975 Ryusuke Konishi 2010-12-26 533
ce1966344933bb Vishal Moola (Oracle 2022-08-15 534) } while (++i < nr);
622daaff0a8975 Ryusuke Konishi 2010-12-26 535
ce1966344933bb Vishal Moola (Oracle 2022-08-15 536) folio_batch_release(&fbatch);
622daaff0a8975 Ryusuke Konishi 2010-12-26 537 cond_resched();
622daaff0a8975 Ryusuke Konishi 2010-12-26 538 goto repeat;
622daaff0a8975 Ryusuke Konishi 2010-12-26 539
622daaff0a8975 Ryusuke Konishi 2010-12-26 540 out_locked:
ce1966344933bb Vishal Moola (Oracle 2022-08-15 541) folio_unlock(folio);
622daaff0a8975 Ryusuke Konishi 2010-12-26 @542 out:
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 5/7] nilfs2: Convert nilfs_find_uncommited_extent() to use filemap_get_folios_contig()
@ 2022-08-16 2:47 ` kernel test robot
0 siblings, 0 replies; 14+ messages in thread
From: kernel test robot @ 2022-08-16 2:47 UTC (permalink / raw)
To: Vishal Moola (Oracle), linux-fsdevel
Cc: llvm, kbuild-all, linux-btrfs, linux-nilfs, linux-mm,
linux-kernel, Vishal Moola (Oracle)
Hi "Vishal,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v6.0-rc1 next-20220815]
[cannot apply to kdave/for-next konis-nilfs2/upstream]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Vishal-Moola-Oracle/Convert-to-filemap_get_folios_contig/20220816-025830
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 568035b01cfb107af8d2e4bd2fb9aea22cf5b868
config: s390-randconfig-r044-20220815 (https://download.01.org/0day-ci/archive/20220816/202208161010.5ZmABhnS-lkp@intel.com/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 6afcc4a459ead8809a0d6d9b4bf7b64bcc13582b)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install s390 cross compiling tool for clang build
# apt-get install binutils-s390x-linux-gnu
# https://github.com/intel-lab-lkp/linux/commit/ce1966344933bbe10010035cd25f23ec7dd76914
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Vishal-Moola-Oracle/Convert-to-filemap_get_folios_contig/20220816-025830
git checkout ce1966344933bbe10010035cd25f23ec7dd76914
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=s390 SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> fs/nilfs2/page.c:542:1: warning: unused label 'out' [-Wunused-label]
out:
^~~~
1 warning generated.
vim +/out +542 fs/nilfs2/page.c
622daaff0a8975 Ryusuke Konishi 2010-12-26 466
622daaff0a8975 Ryusuke Konishi 2010-12-26 467 /**
622daaff0a8975 Ryusuke Konishi 2010-12-26 468 * nilfs_find_uncommitted_extent - find extent of uncommitted data
622daaff0a8975 Ryusuke Konishi 2010-12-26 469 * @inode: inode
622daaff0a8975 Ryusuke Konishi 2010-12-26 470 * @start_blk: start block offset (in)
622daaff0a8975 Ryusuke Konishi 2010-12-26 471 * @blkoff: start offset of the found extent (out)
622daaff0a8975 Ryusuke Konishi 2010-12-26 472 *
622daaff0a8975 Ryusuke Konishi 2010-12-26 473 * This function searches an extent of buffers marked "delayed" which
622daaff0a8975 Ryusuke Konishi 2010-12-26 474 * starts from a block offset equal to or larger than @start_blk. If
622daaff0a8975 Ryusuke Konishi 2010-12-26 475 * such an extent was found, this will store the start offset in
622daaff0a8975 Ryusuke Konishi 2010-12-26 476 * @blkoff and return its length in blocks. Otherwise, zero is
622daaff0a8975 Ryusuke Konishi 2010-12-26 477 * returned.
622daaff0a8975 Ryusuke Konishi 2010-12-26 478 */
622daaff0a8975 Ryusuke Konishi 2010-12-26 479 unsigned long nilfs_find_uncommitted_extent(struct inode *inode,
622daaff0a8975 Ryusuke Konishi 2010-12-26 480 sector_t start_blk,
622daaff0a8975 Ryusuke Konishi 2010-12-26 481 sector_t *blkoff)
622daaff0a8975 Ryusuke Konishi 2010-12-26 482 {
ce1966344933bb Vishal Moola (Oracle 2022-08-15 483) unsigned int i, nr;
622daaff0a8975 Ryusuke Konishi 2010-12-26 484 pgoff_t index;
622daaff0a8975 Ryusuke Konishi 2010-12-26 485 unsigned int nblocks_in_page;
622daaff0a8975 Ryusuke Konishi 2010-12-26 486 unsigned long length = 0;
622daaff0a8975 Ryusuke Konishi 2010-12-26 487 sector_t b;
ce1966344933bb Vishal Moola (Oracle 2022-08-15 488) struct folio_batch fbatch;
ce1966344933bb Vishal Moola (Oracle 2022-08-15 489) struct folio *folio;
622daaff0a8975 Ryusuke Konishi 2010-12-26 490
622daaff0a8975 Ryusuke Konishi 2010-12-26 491 if (inode->i_mapping->nrpages == 0)
622daaff0a8975 Ryusuke Konishi 2010-12-26 492 return 0;
622daaff0a8975 Ryusuke Konishi 2010-12-26 493
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01 494 index = start_blk >> (PAGE_SHIFT - inode->i_blkbits);
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01 495 nblocks_in_page = 1U << (PAGE_SHIFT - inode->i_blkbits);
622daaff0a8975 Ryusuke Konishi 2010-12-26 496
ce1966344933bb Vishal Moola (Oracle 2022-08-15 497) folio_batch_init(&fbatch);
622daaff0a8975 Ryusuke Konishi 2010-12-26 498
622daaff0a8975 Ryusuke Konishi 2010-12-26 499 repeat:
ce1966344933bb Vishal Moola (Oracle 2022-08-15 500) nr = filemap_get_folios_contig(inode->i_mapping, &index, ULONG_MAX,
ce1966344933bb Vishal Moola (Oracle 2022-08-15 501) &fbatch);
ce1966344933bb Vishal Moola (Oracle 2022-08-15 502) if (nr == 0)
622daaff0a8975 Ryusuke Konishi 2010-12-26 503 return length;
622daaff0a8975 Ryusuke Konishi 2010-12-26 504
ce1966344933bb Vishal Moola (Oracle 2022-08-15 505) b = fbatch.folios[0]->index << (PAGE_SHIFT - inode->i_blkbits);
622daaff0a8975 Ryusuke Konishi 2010-12-26 506 i = 0;
622daaff0a8975 Ryusuke Konishi 2010-12-26 507 do {
ce1966344933bb Vishal Moola (Oracle 2022-08-15 508) folio = fbatch.folios[i];
622daaff0a8975 Ryusuke Konishi 2010-12-26 509
ce1966344933bb Vishal Moola (Oracle 2022-08-15 510) folio_lock(folio);
ce1966344933bb Vishal Moola (Oracle 2022-08-15 511) if (folio_buffers(folio)) {
622daaff0a8975 Ryusuke Konishi 2010-12-26 512 struct buffer_head *bh, *head;
622daaff0a8975 Ryusuke Konishi 2010-12-26 513
ce1966344933bb Vishal Moola (Oracle 2022-08-15 514) bh = head = folio_buffers(folio);
622daaff0a8975 Ryusuke Konishi 2010-12-26 515 do {
622daaff0a8975 Ryusuke Konishi 2010-12-26 516 if (b < start_blk)
622daaff0a8975 Ryusuke Konishi 2010-12-26 517 continue;
622daaff0a8975 Ryusuke Konishi 2010-12-26 518 if (buffer_delay(bh)) {
622daaff0a8975 Ryusuke Konishi 2010-12-26 519 if (length == 0)
622daaff0a8975 Ryusuke Konishi 2010-12-26 520 *blkoff = b;
622daaff0a8975 Ryusuke Konishi 2010-12-26 521 length++;
622daaff0a8975 Ryusuke Konishi 2010-12-26 522 } else if (length > 0) {
622daaff0a8975 Ryusuke Konishi 2010-12-26 523 goto out_locked;
622daaff0a8975 Ryusuke Konishi 2010-12-26 524 }
622daaff0a8975 Ryusuke Konishi 2010-12-26 525 } while (++b, bh = bh->b_this_page, bh != head);
622daaff0a8975 Ryusuke Konishi 2010-12-26 526 } else {
622daaff0a8975 Ryusuke Konishi 2010-12-26 527 if (length > 0)
622daaff0a8975 Ryusuke Konishi 2010-12-26 528 goto out_locked;
622daaff0a8975 Ryusuke Konishi 2010-12-26 529
622daaff0a8975 Ryusuke Konishi 2010-12-26 530 b += nblocks_in_page;
622daaff0a8975 Ryusuke Konishi 2010-12-26 531 }
ce1966344933bb Vishal Moola (Oracle 2022-08-15 532) folio_unlock(folio);
622daaff0a8975 Ryusuke Konishi 2010-12-26 533
ce1966344933bb Vishal Moola (Oracle 2022-08-15 534) } while (++i < nr);
622daaff0a8975 Ryusuke Konishi 2010-12-26 535
ce1966344933bb Vishal Moola (Oracle 2022-08-15 536) folio_batch_release(&fbatch);
622daaff0a8975 Ryusuke Konishi 2010-12-26 537 cond_resched();
622daaff0a8975 Ryusuke Konishi 2010-12-26 538 goto repeat;
622daaff0a8975 Ryusuke Konishi 2010-12-26 539
622daaff0a8975 Ryusuke Konishi 2010-12-26 540 out_locked:
ce1966344933bb Vishal Moola (Oracle 2022-08-15 541) folio_unlock(folio);
622daaff0a8975 Ryusuke Konishi 2010-12-26 @542 out:
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 5/7] nilfs2: Convert nilfs_find_uncommited_extent() to use filemap_get_folios_contig()
@ 2022-08-16 2:47 ` kernel test robot
0 siblings, 0 replies; 14+ messages in thread
From: kernel test robot @ 2022-08-16 2:47 UTC (permalink / raw)
To: Vishal Moola (Oracle), linux-fsdevel-u79uwXL29TY76Z2rM5mHXA
Cc: llvm-cunTk1MwBs/YUNznpcFYbw, kbuild-all-hn68Rpc1hR1g9hUCZPvPmw,
linux-btrfs-u79uwXL29TY76Z2rM5mHXA,
linux-nilfs-u79uwXL29TY76Z2rM5mHXA,
linux-mm-Bw31MaZKKs3YtjvyW6yDsg,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, Vishal Moola (Oracle)
Hi "Vishal,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v6.0-rc1 next-20220815]
[cannot apply to kdave/for-next konis-nilfs2/upstream]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Vishal-Moola-Oracle/Convert-to-filemap_get_folios_contig/20220816-025830
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 568035b01cfb107af8d2e4bd2fb9aea22cf5b868
config: s390-randconfig-r044-20220815 (https://download.01.org/0day-ci/archive/20220816/202208161010.5ZmABhnS-lkp-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 6afcc4a459ead8809a0d6d9b4bf7b64bcc13582b)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install s390 cross compiling tool for clang build
# apt-get install binutils-s390x-linux-gnu
# https://github.com/intel-lab-lkp/linux/commit/ce1966344933bbe10010035cd25f23ec7dd76914
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Vishal-Moola-Oracle/Convert-to-filemap_get_folios_contig/20220816-025830
git checkout ce1966344933bbe10010035cd25f23ec7dd76914
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=s390 SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
All warnings (new ones prefixed by >>):
>> fs/nilfs2/page.c:542:1: warning: unused label 'out' [-Wunused-label]
out:
^~~~
1 warning generated.
vim +/out +542 fs/nilfs2/page.c
622daaff0a8975 Ryusuke Konishi 2010-12-26 466
622daaff0a8975 Ryusuke Konishi 2010-12-26 467 /**
622daaff0a8975 Ryusuke Konishi 2010-12-26 468 * nilfs_find_uncommitted_extent - find extent of uncommitted data
622daaff0a8975 Ryusuke Konishi 2010-12-26 469 * @inode: inode
622daaff0a8975 Ryusuke Konishi 2010-12-26 470 * @start_blk: start block offset (in)
622daaff0a8975 Ryusuke Konishi 2010-12-26 471 * @blkoff: start offset of the found extent (out)
622daaff0a8975 Ryusuke Konishi 2010-12-26 472 *
622daaff0a8975 Ryusuke Konishi 2010-12-26 473 * This function searches an extent of buffers marked "delayed" which
622daaff0a8975 Ryusuke Konishi 2010-12-26 474 * starts from a block offset equal to or larger than @start_blk. If
622daaff0a8975 Ryusuke Konishi 2010-12-26 475 * such an extent was found, this will store the start offset in
622daaff0a8975 Ryusuke Konishi 2010-12-26 476 * @blkoff and return its length in blocks. Otherwise, zero is
622daaff0a8975 Ryusuke Konishi 2010-12-26 477 * returned.
622daaff0a8975 Ryusuke Konishi 2010-12-26 478 */
622daaff0a8975 Ryusuke Konishi 2010-12-26 479 unsigned long nilfs_find_uncommitted_extent(struct inode *inode,
622daaff0a8975 Ryusuke Konishi 2010-12-26 480 sector_t start_blk,
622daaff0a8975 Ryusuke Konishi 2010-12-26 481 sector_t *blkoff)
622daaff0a8975 Ryusuke Konishi 2010-12-26 482 {
ce1966344933bb Vishal Moola (Oracle 2022-08-15 483) unsigned int i, nr;
622daaff0a8975 Ryusuke Konishi 2010-12-26 484 pgoff_t index;
622daaff0a8975 Ryusuke Konishi 2010-12-26 485 unsigned int nblocks_in_page;
622daaff0a8975 Ryusuke Konishi 2010-12-26 486 unsigned long length = 0;
622daaff0a8975 Ryusuke Konishi 2010-12-26 487 sector_t b;
ce1966344933bb Vishal Moola (Oracle 2022-08-15 488) struct folio_batch fbatch;
ce1966344933bb Vishal Moola (Oracle 2022-08-15 489) struct folio *folio;
622daaff0a8975 Ryusuke Konishi 2010-12-26 490
622daaff0a8975 Ryusuke Konishi 2010-12-26 491 if (inode->i_mapping->nrpages == 0)
622daaff0a8975 Ryusuke Konishi 2010-12-26 492 return 0;
622daaff0a8975 Ryusuke Konishi 2010-12-26 493
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01 494 index = start_blk >> (PAGE_SHIFT - inode->i_blkbits);
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01 495 nblocks_in_page = 1U << (PAGE_SHIFT - inode->i_blkbits);
622daaff0a8975 Ryusuke Konishi 2010-12-26 496
ce1966344933bb Vishal Moola (Oracle 2022-08-15 497) folio_batch_init(&fbatch);
622daaff0a8975 Ryusuke Konishi 2010-12-26 498
622daaff0a8975 Ryusuke Konishi 2010-12-26 499 repeat:
ce1966344933bb Vishal Moola (Oracle 2022-08-15 500) nr = filemap_get_folios_contig(inode->i_mapping, &index, ULONG_MAX,
ce1966344933bb Vishal Moola (Oracle 2022-08-15 501) &fbatch);
ce1966344933bb Vishal Moola (Oracle 2022-08-15 502) if (nr == 0)
622daaff0a8975 Ryusuke Konishi 2010-12-26 503 return length;
622daaff0a8975 Ryusuke Konishi 2010-12-26 504
ce1966344933bb Vishal Moola (Oracle 2022-08-15 505) b = fbatch.folios[0]->index << (PAGE_SHIFT - inode->i_blkbits);
622daaff0a8975 Ryusuke Konishi 2010-12-26 506 i = 0;
622daaff0a8975 Ryusuke Konishi 2010-12-26 507 do {
ce1966344933bb Vishal Moola (Oracle 2022-08-15 508) folio = fbatch.folios[i];
622daaff0a8975 Ryusuke Konishi 2010-12-26 509
ce1966344933bb Vishal Moola (Oracle 2022-08-15 510) folio_lock(folio);
ce1966344933bb Vishal Moola (Oracle 2022-08-15 511) if (folio_buffers(folio)) {
622daaff0a8975 Ryusuke Konishi 2010-12-26 512 struct buffer_head *bh, *head;
622daaff0a8975 Ryusuke Konishi 2010-12-26 513
ce1966344933bb Vishal Moola (Oracle 2022-08-15 514) bh = head = folio_buffers(folio);
622daaff0a8975 Ryusuke Konishi 2010-12-26 515 do {
622daaff0a8975 Ryusuke Konishi 2010-12-26 516 if (b < start_blk)
622daaff0a8975 Ryusuke Konishi 2010-12-26 517 continue;
622daaff0a8975 Ryusuke Konishi 2010-12-26 518 if (buffer_delay(bh)) {
622daaff0a8975 Ryusuke Konishi 2010-12-26 519 if (length == 0)
622daaff0a8975 Ryusuke Konishi 2010-12-26 520 *blkoff = b;
622daaff0a8975 Ryusuke Konishi 2010-12-26 521 length++;
622daaff0a8975 Ryusuke Konishi 2010-12-26 522 } else if (length > 0) {
622daaff0a8975 Ryusuke Konishi 2010-12-26 523 goto out_locked;
622daaff0a8975 Ryusuke Konishi 2010-12-26 524 }
622daaff0a8975 Ryusuke Konishi 2010-12-26 525 } while (++b, bh = bh->b_this_page, bh != head);
622daaff0a8975 Ryusuke Konishi 2010-12-26 526 } else {
622daaff0a8975 Ryusuke Konishi 2010-12-26 527 if (length > 0)
622daaff0a8975 Ryusuke Konishi 2010-12-26 528 goto out_locked;
622daaff0a8975 Ryusuke Konishi 2010-12-26 529
622daaff0a8975 Ryusuke Konishi 2010-12-26 530 b += nblocks_in_page;
622daaff0a8975 Ryusuke Konishi 2010-12-26 531 }
ce1966344933bb Vishal Moola (Oracle 2022-08-15 532) folio_unlock(folio);
622daaff0a8975 Ryusuke Konishi 2010-12-26 533
ce1966344933bb Vishal Moola (Oracle 2022-08-15 534) } while (++i < nr);
622daaff0a8975 Ryusuke Konishi 2010-12-26 535
ce1966344933bb Vishal Moola (Oracle 2022-08-15 536) folio_batch_release(&fbatch);
622daaff0a8975 Ryusuke Konishi 2010-12-26 537 cond_resched();
622daaff0a8975 Ryusuke Konishi 2010-12-26 538 goto repeat;
622daaff0a8975 Ryusuke Konishi 2010-12-26 539
622daaff0a8975 Ryusuke Konishi 2010-12-26 540 out_locked:
ce1966344933bb Vishal Moola (Oracle 2022-08-15 541) folio_unlock(folio);
622daaff0a8975 Ryusuke Konishi 2010-12-26 @542 out:
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 5/7] nilfs2: Convert nilfs_find_uncommited_extent() to use filemap_get_folios_contig()
@ 2022-08-16 3:49 kernel test robot
0 siblings, 0 replies; 14+ messages in thread
From: kernel test robot @ 2022-08-16 3:49 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 8500 bytes --]
::::::
:::::: Manual check reason: "low confidence static check warning: fs/nilfs2/page.c:542:1: sparse: sparse: unused label 'out'"
::::::
BCC: lkp(a)intel.com
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20220815185452.37447-6-vishal.moola@gmail.com>
References: <20220815185452.37447-6-vishal.moola@gmail.com>
TO: "Vishal Moola (Oracle)" <vishal.moola@gmail.com>
TO: linux-fsdevel(a)vger.kernel.org
CC: linux-btrfs(a)vger.kernel.org
CC: linux-nilfs(a)vger.kernel.org
CC: linux-mm(a)kvack.org
CC: linux-kernel(a)vger.kernel.org
CC: "Vishal Moola (Oracle)" <vishal.moola@gmail.com>
Hi "Vishal,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v6.0-rc1 next-20220815]
[cannot apply to kdave/for-next konis-nilfs2/upstream]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Vishal-Moola-Oracle/Convert-to-filemap_get_folios_contig/20220816-025830
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 568035b01cfb107af8d2e4bd2fb9aea22cf5b868
:::::: branch date: 9 hours ago
:::::: commit date: 9 hours ago
config: i386-randconfig-s001-20220815 (https://download.01.org/0day-ci/archive/20220816/202208161124.6bsJaKsJ-lkp(a)intel.com/config)
compiler: gcc-11 (Debian 11.3.0-5) 11.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-39-gce1a6720-dirty
# https://github.com/intel-lab-lkp/linux/commit/ce1966344933bbe10010035cd25f23ec7dd76914
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Vishal-Moola-Oracle/Convert-to-filemap_get_folios_contig/20220816-025830
git checkout ce1966344933bbe10010035cd25f23ec7dd76914
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 SHELL=/bin/bash fs/nilfs2/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
sparse warnings: (new ones prefixed by >>)
>> fs/nilfs2/page.c:542:1: sparse: sparse: unused label 'out'
vim +/out +542 fs/nilfs2/page.c
622daaff0a8975 Ryusuke Konishi 2010-12-26 466
622daaff0a8975 Ryusuke Konishi 2010-12-26 467 /**
622daaff0a8975 Ryusuke Konishi 2010-12-26 468 * nilfs_find_uncommitted_extent - find extent of uncommitted data
622daaff0a8975 Ryusuke Konishi 2010-12-26 469 * @inode: inode
622daaff0a8975 Ryusuke Konishi 2010-12-26 470 * @start_blk: start block offset (in)
622daaff0a8975 Ryusuke Konishi 2010-12-26 471 * @blkoff: start offset of the found extent (out)
622daaff0a8975 Ryusuke Konishi 2010-12-26 472 *
622daaff0a8975 Ryusuke Konishi 2010-12-26 473 * This function searches an extent of buffers marked "delayed" which
622daaff0a8975 Ryusuke Konishi 2010-12-26 474 * starts from a block offset equal to or larger than @start_blk. If
622daaff0a8975 Ryusuke Konishi 2010-12-26 475 * such an extent was found, this will store the start offset in
622daaff0a8975 Ryusuke Konishi 2010-12-26 476 * @blkoff and return its length in blocks. Otherwise, zero is
622daaff0a8975 Ryusuke Konishi 2010-12-26 477 * returned.
622daaff0a8975 Ryusuke Konishi 2010-12-26 478 */
622daaff0a8975 Ryusuke Konishi 2010-12-26 479 unsigned long nilfs_find_uncommitted_extent(struct inode *inode,
622daaff0a8975 Ryusuke Konishi 2010-12-26 480 sector_t start_blk,
622daaff0a8975 Ryusuke Konishi 2010-12-26 481 sector_t *blkoff)
622daaff0a8975 Ryusuke Konishi 2010-12-26 482 {
ce1966344933bb Vishal Moola (Oracle 2022-08-15 483) unsigned int i, nr;
622daaff0a8975 Ryusuke Konishi 2010-12-26 484 pgoff_t index;
622daaff0a8975 Ryusuke Konishi 2010-12-26 485 unsigned int nblocks_in_page;
622daaff0a8975 Ryusuke Konishi 2010-12-26 486 unsigned long length = 0;
622daaff0a8975 Ryusuke Konishi 2010-12-26 487 sector_t b;
ce1966344933bb Vishal Moola (Oracle 2022-08-15 488) struct folio_batch fbatch;
ce1966344933bb Vishal Moola (Oracle 2022-08-15 489) struct folio *folio;
622daaff0a8975 Ryusuke Konishi 2010-12-26 490
622daaff0a8975 Ryusuke Konishi 2010-12-26 491 if (inode->i_mapping->nrpages == 0)
622daaff0a8975 Ryusuke Konishi 2010-12-26 492 return 0;
622daaff0a8975 Ryusuke Konishi 2010-12-26 493
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01 494 index = start_blk >> (PAGE_SHIFT - inode->i_blkbits);
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01 495 nblocks_in_page = 1U << (PAGE_SHIFT - inode->i_blkbits);
622daaff0a8975 Ryusuke Konishi 2010-12-26 496
ce1966344933bb Vishal Moola (Oracle 2022-08-15 497) folio_batch_init(&fbatch);
622daaff0a8975 Ryusuke Konishi 2010-12-26 498
622daaff0a8975 Ryusuke Konishi 2010-12-26 499 repeat:
ce1966344933bb Vishal Moola (Oracle 2022-08-15 500) nr = filemap_get_folios_contig(inode->i_mapping, &index, ULONG_MAX,
ce1966344933bb Vishal Moola (Oracle 2022-08-15 501) &fbatch);
ce1966344933bb Vishal Moola (Oracle 2022-08-15 502) if (nr == 0)
622daaff0a8975 Ryusuke Konishi 2010-12-26 503 return length;
622daaff0a8975 Ryusuke Konishi 2010-12-26 504
ce1966344933bb Vishal Moola (Oracle 2022-08-15 505) b = fbatch.folios[0]->index << (PAGE_SHIFT - inode->i_blkbits);
622daaff0a8975 Ryusuke Konishi 2010-12-26 506 i = 0;
622daaff0a8975 Ryusuke Konishi 2010-12-26 507 do {
ce1966344933bb Vishal Moola (Oracle 2022-08-15 508) folio = fbatch.folios[i];
622daaff0a8975 Ryusuke Konishi 2010-12-26 509
ce1966344933bb Vishal Moola (Oracle 2022-08-15 510) folio_lock(folio);
ce1966344933bb Vishal Moola (Oracle 2022-08-15 511) if (folio_buffers(folio)) {
622daaff0a8975 Ryusuke Konishi 2010-12-26 512 struct buffer_head *bh, *head;
622daaff0a8975 Ryusuke Konishi 2010-12-26 513
ce1966344933bb Vishal Moola (Oracle 2022-08-15 514) bh = head = folio_buffers(folio);
622daaff0a8975 Ryusuke Konishi 2010-12-26 515 do {
622daaff0a8975 Ryusuke Konishi 2010-12-26 516 if (b < start_blk)
622daaff0a8975 Ryusuke Konishi 2010-12-26 517 continue;
622daaff0a8975 Ryusuke Konishi 2010-12-26 518 if (buffer_delay(bh)) {
622daaff0a8975 Ryusuke Konishi 2010-12-26 519 if (length == 0)
622daaff0a8975 Ryusuke Konishi 2010-12-26 520 *blkoff = b;
622daaff0a8975 Ryusuke Konishi 2010-12-26 521 length++;
622daaff0a8975 Ryusuke Konishi 2010-12-26 522 } else if (length > 0) {
622daaff0a8975 Ryusuke Konishi 2010-12-26 523 goto out_locked;
622daaff0a8975 Ryusuke Konishi 2010-12-26 524 }
622daaff0a8975 Ryusuke Konishi 2010-12-26 525 } while (++b, bh = bh->b_this_page, bh != head);
622daaff0a8975 Ryusuke Konishi 2010-12-26 526 } else {
622daaff0a8975 Ryusuke Konishi 2010-12-26 527 if (length > 0)
622daaff0a8975 Ryusuke Konishi 2010-12-26 528 goto out_locked;
622daaff0a8975 Ryusuke Konishi 2010-12-26 529
622daaff0a8975 Ryusuke Konishi 2010-12-26 530 b += nblocks_in_page;
622daaff0a8975 Ryusuke Konishi 2010-12-26 531 }
ce1966344933bb Vishal Moola (Oracle 2022-08-15 532) folio_unlock(folio);
622daaff0a8975 Ryusuke Konishi 2010-12-26 533
ce1966344933bb Vishal Moola (Oracle 2022-08-15 534) } while (++i < nr);
622daaff0a8975 Ryusuke Konishi 2010-12-26 535
ce1966344933bb Vishal Moola (Oracle 2022-08-15 536) folio_batch_release(&fbatch);
622daaff0a8975 Ryusuke Konishi 2010-12-26 537 cond_resched();
622daaff0a8975 Ryusuke Konishi 2010-12-26 538 goto repeat;
622daaff0a8975 Ryusuke Konishi 2010-12-26 539
622daaff0a8975 Ryusuke Konishi 2010-12-26 540 out_locked:
ce1966344933bb Vishal Moola (Oracle 2022-08-15 541) folio_unlock(folio);
622daaff0a8975 Ryusuke Konishi 2010-12-26 @542 out:
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2022-08-16 3:49 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-15 18:54 [PATCH 0/7] Convert to filemap_get_folios_contig() Vishal Moola (Oracle)
2022-08-15 18:54 ` [PATCH 1/7] filemap: Add filemap_get_folios_contig() Vishal Moola (Oracle)
2022-08-15 18:54 ` [PATCH 2/7] btrfs: Convert __process_pages_contig() to use filemap_get_folios_contig() Vishal Moola (Oracle)
2022-08-15 18:54 ` [PATCH 3/7] btrfs: Convert end_compressed_writeback() to use filemap_get_folios() Vishal Moola (Oracle)
2022-08-15 18:54 ` [PATCH 4/7] btrfs: Convert process_page_range() to use filemap_get_folios_contig() Vishal Moola (Oracle)
2022-08-15 18:54 ` [PATCH 5/7] nilfs2: Convert nilfs_find_uncommited_extent() " Vishal Moola (Oracle)
2022-08-15 23:34 ` kernel test robot
2022-08-16 2:47 ` kernel test robot
2022-08-16 2:47 ` kernel test robot
2022-08-15 18:54 ` [PATCH 6/7] ramfs: Convert ramfs_nommu_get_unmapped_area() " Vishal Moola (Oracle)
2022-08-15 18:54 ` [PATCH 7/7] filemap: Remove find_get_pages_contig() Vishal Moola (Oracle)
2022-08-15 18:54 ` Vishal Moola (Oracle)
2022-08-15 20:17 ` [PATCH 0/7] Convert to filemap_get_folios_contig() Matthew Wilcox
2022-08-16 3:49 [PATCH 5/7] nilfs2: Convert nilfs_find_uncommited_extent() to use filemap_get_folios_contig() kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.