lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-Id: <20170601093245.29238-10-jack@suse.cz> Date: Thu, 1 Jun 2017 11:32:19 +0200 From: Jan Kara <jack@...e.cz> To: <linux-mm@...ck.org> Cc: Hugh Dickins <hughd@...gle.com>, David Howells <dhowells@...hat.com>, linux-afs@...ts.infradead.org, Ryusuke Konishi <konishi.ryusuke@....ntt.co.jp>, linux-nilfs@...r.kernel.org, Bob Peterson <rpeterso@...hat.com>, cluster-devel@...hat.com, Jaegeuk Kim <jaegeuk@...nel.org>, linux-f2fs-devel@...ts.sourceforge.net, tytso@....edu, linux-ext4@...r.kernel.org, Ilya Dryomov <idryomov@...il.com>, "Yan, Zheng" <zyan@...hat.com>, ceph-devel@...r.kernel.org, linux-btrfs@...r.kernel.org, David Sterba <dsterba@...e.com>, "Darrick J . Wong" <darrick.wong@...cle.com>, linux-xfs@...r.kernel.org, Nadia Yvette Chambers <nyc@...omorphy.com>, Jan Kara <jack@...e.cz> Subject: [PATCH 09/35] ext4: Use pagevec_lookup_range() in ext4_find_unwritten_pgoff() Use pagevec_lookup_range() in ext4_find_unwritten_pgoff() since we are interested only in pages in the given range. Simplify the logic as a result of not getting pages out of range and index getting automatically advanced. CC: linux-ext4@...r.kernel.org CC: "Theodore Ts'o" <tytso@....edu> Signed-off-by: Jan Kara <jack@...e.cz> --- fs/ext4/file.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/fs/ext4/file.c b/fs/ext4/file.c index ddca17c7875a..6821070a388b 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c @@ -478,12 +478,11 @@ static int ext4_find_unwritten_pgoff(struct inode *inode, pagevec_init(&pvec, 0); do { - int i, num; + int i; unsigned long nr_pages; - num = min_t(pgoff_t, end - index, PAGEVEC_SIZE); - nr_pages = pagevec_lookup(&pvec, inode->i_mapping, &index, - (pgoff_t)num); + nr_pages = pagevec_lookup_range(&pvec, inode->i_mapping, + &index, end, PAGEVEC_SIZE); if (nr_pages == 0) break; @@ -502,9 +501,6 @@ static int ext4_find_unwritten_pgoff(struct inode *inode, goto out; } - if (page->index > end) - goto out; - lock_page(page); if (unlikely(page->mapping != inode->i_mapping)) { @@ -544,12 +540,10 @@ static int ext4_find_unwritten_pgoff(struct inode *inode, unlock_page(page); } - /* The no. of pages is less than our desired, we are done. */ - if (nr_pages < num) - break; pagevec_release(&pvec); } while (index <= end); + /* There are no pages upto endoff - that would be a hole in there. */ if (whence == SEEK_HOLE && lastoff < endoff) { found = 1; *offset = lastoff; -- 2.12.3
Powered by blists - more mailing lists