aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs/node.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-11-15 22:42:40 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-11-15 22:42:40 -0500
commit7c225c69f86c934e3be9be63ecde754e286838d7 (patch)
treeff2df419b0c4886b37407235f7d21215e4cf45e4 /fs/f2fs/node.c
parent6363b3f3ac5be096d08c8c504128befa0c033529 (diff)
parent1b7176aea0a924ac59c6a283129d3e8eb00aa915 (diff)
Merge branch 'akpm' (patches from Andrew)
Merge updates from Andrew Morton: - a few misc bits - ocfs2 updates - almost all of MM * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (131 commits) memory hotplug: fix comments when adding section mm: make alloc_node_mem_map a void call if we don't have CONFIG_FLAT_NODE_MEM_MAP mm: simplify nodemask printing mm,oom_reaper: remove pointless kthread_run() error check mm/page_ext.c: check if page_ext is not prepared writeback: remove unused function parameter mm: do not rely on preempt_count in print_vma_addr mm, sparse: do not swamp log with huge vmemmap allocation failures mm/hmm: remove redundant variable align_end mm/list_lru.c: mark expected switch fall-through mm/shmem.c: mark expected switch fall-through mm/page_alloc.c: broken deferred calculation mm: don't warn about allocations which stall for too long fs: fuse: account fuse_inode slab memory as reclaimable mm, page_alloc: fix potential false positive in __zone_watermark_ok mm: mlock: remove lru_add_drain_all() mm, sysctl: make NUMA stats configurable shmem: convert shmem_init_inodecache() to void Unify migrate_pages and move_pages access checks mm, pagevec: rename pagevec drained field ...
Diffstat (limited to 'fs/f2fs/node.c')
-rw-r--r--fs/f2fs/node.c73
1 files changed, 27 insertions, 46 deletions
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index fca87835a1da..b33dac9592ca 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -1277,21 +1277,17 @@ release_page:
1277 1277
1278static struct page *last_fsync_dnode(struct f2fs_sb_info *sbi, nid_t ino) 1278static struct page *last_fsync_dnode(struct f2fs_sb_info *sbi, nid_t ino)
1279{ 1279{
1280 pgoff_t index, end; 1280 pgoff_t index;
1281 struct pagevec pvec; 1281 struct pagevec pvec;
1282 struct page *last_page = NULL; 1282 struct page *last_page = NULL;
1283 int nr_pages;
1283 1284
1284 pagevec_init(&pvec, 0); 1285 pagevec_init(&pvec);
1285 index = 0; 1286 index = 0;
1286 end = ULONG_MAX; 1287
1287 1288 while ((nr_pages = pagevec_lookup_tag(&pvec, NODE_MAPPING(sbi), &index,
1288 while (index <= end) { 1289 PAGECACHE_TAG_DIRTY))) {
1289 int i, nr_pages; 1290 int i;
1290 nr_pages = pagevec_lookup_tag(&pvec, NODE_MAPPING(sbi), &index,
1291 PAGECACHE_TAG_DIRTY,
1292 min(end - index, (pgoff_t)PAGEVEC_SIZE-1) + 1);
1293 if (nr_pages == 0)
1294 break;
1295 1291
1296 for (i = 0; i < nr_pages; i++) { 1292 for (i = 0; i < nr_pages; i++) {
1297 struct page *page = pvec.pages[i]; 1293 struct page *page = pvec.pages[i];
@@ -1425,13 +1421,14 @@ static int f2fs_write_node_page(struct page *page,
1425int fsync_node_pages(struct f2fs_sb_info *sbi, struct inode *inode, 1421int fsync_node_pages(struct f2fs_sb_info *sbi, struct inode *inode,
1426 struct writeback_control *wbc, bool atomic) 1422 struct writeback_control *wbc, bool atomic)
1427{ 1423{
1428 pgoff_t index, end; 1424 pgoff_t index;
1429 pgoff_t last_idx = ULONG_MAX; 1425 pgoff_t last_idx = ULONG_MAX;
1430 struct pagevec pvec; 1426 struct pagevec pvec;
1431 int ret = 0; 1427 int ret = 0;
1432 struct page *last_page = NULL; 1428 struct page *last_page = NULL;
1433 bool marked = false; 1429 bool marked = false;
1434 nid_t ino = inode->i_ino; 1430 nid_t ino = inode->i_ino;
1431 int nr_pages;
1435 1432
1436 if (atomic) { 1433 if (atomic) {
1437 last_page = last_fsync_dnode(sbi, ino); 1434 last_page = last_fsync_dnode(sbi, ino);
@@ -1439,17 +1436,12 @@ int fsync_node_pages(struct f2fs_sb_info *sbi, struct inode *inode,
1439 return PTR_ERR_OR_ZERO(last_page); 1436 return PTR_ERR_OR_ZERO(last_page);
1440 } 1437 }
1441retry: 1438retry:
1442 pagevec_init(&pvec, 0); 1439 pagevec_init(&pvec);
1443 index = 0; 1440 index = 0;
1444 end = ULONG_MAX; 1441
1445 1442 while ((nr_pages = pagevec_lookup_tag(&pvec, NODE_MAPPING(sbi), &index,
1446 while (index <= end) { 1443 PAGECACHE_TAG_DIRTY))) {
1447 int i, nr_pages; 1444 int i;
1448 nr_pages = pagevec_lookup_tag(&pvec, NODE_MAPPING(sbi), &index,
1449 PAGECACHE_TAG_DIRTY,
1450 min(end - index, (pgoff_t)PAGEVEC_SIZE-1) + 1);
1451 if (nr_pages == 0)
1452 break;
1453 1445
1454 for (i = 0; i < nr_pages; i++) { 1446 for (i = 0; i < nr_pages; i++) {
1455 struct page *page = pvec.pages[i]; 1447 struct page *page = pvec.pages[i];
@@ -1548,25 +1540,21 @@ out:
1548int sync_node_pages(struct f2fs_sb_info *sbi, struct writeback_control *wbc, 1540int sync_node_pages(struct f2fs_sb_info *sbi, struct writeback_control *wbc,
1549 bool do_balance, enum iostat_type io_type) 1541 bool do_balance, enum iostat_type io_type)
1550{ 1542{
1551 pgoff_t index, end; 1543 pgoff_t index;
1552 struct pagevec pvec; 1544 struct pagevec pvec;
1553 int step = 0; 1545 int step = 0;
1554 int nwritten = 0; 1546 int nwritten = 0;
1555 int ret = 0; 1547 int ret = 0;
1548 int nr_pages;
1556 1549
1557 pagevec_init(&pvec, 0); 1550 pagevec_init(&pvec);
1558 1551
1559next_step: 1552next_step:
1560 index = 0; 1553 index = 0;
1561 end = ULONG_MAX; 1554
1562 1555 while ((nr_pages = pagevec_lookup_tag(&pvec, NODE_MAPPING(sbi), &index,
1563 while (index <= end) { 1556 PAGECACHE_TAG_DIRTY))) {
1564 int i, nr_pages; 1557 int i;
1565 nr_pages = pagevec_lookup_tag(&pvec, NODE_MAPPING(sbi), &index,
1566 PAGECACHE_TAG_DIRTY,
1567 min(end - index, (pgoff_t)PAGEVEC_SIZE-1) + 1);
1568 if (nr_pages == 0)
1569 break;
1570 1558
1571 for (i = 0; i < nr_pages; i++) { 1559 for (i = 0; i < nr_pages; i++) {
1572 struct page *page = pvec.pages[i]; 1560 struct page *page = pvec.pages[i];
@@ -1655,27 +1643,20 @@ out:
1655 1643
1656int wait_on_node_pages_writeback(struct f2fs_sb_info *sbi, nid_t ino) 1644int wait_on_node_pages_writeback(struct f2fs_sb_info *sbi, nid_t ino)
1657{ 1645{
1658 pgoff_t index = 0, end = ULONG_MAX; 1646 pgoff_t index = 0;
1659 struct pagevec pvec; 1647 struct pagevec pvec;
1660 int ret2, ret = 0; 1648 int ret2, ret = 0;
1649 int nr_pages;
1661 1650
1662 pagevec_init(&pvec, 0); 1651 pagevec_init(&pvec);
1663 1652
1664 while (index <= end) { 1653 while ((nr_pages = pagevec_lookup_tag(&pvec, NODE_MAPPING(sbi), &index,
1665 int i, nr_pages; 1654 PAGECACHE_TAG_WRITEBACK))) {
1666 nr_pages = pagevec_lookup_tag(&pvec, NODE_MAPPING(sbi), &index, 1655 int i;
1667 PAGECACHE_TAG_WRITEBACK,
1668 min(end - index, (pgoff_t)PAGEVEC_SIZE-1) + 1);
1669 if (nr_pages == 0)
1670 break;
1671 1656
1672 for (i = 0; i < nr_pages; i++) { 1657 for (i = 0; i < nr_pages; i++) {
1673 struct page *page = pvec.pages[i]; 1658 struct page *page = pvec.pages[i];
1674 1659
1675 /* until radix tree lookup accepts end_index */
1676 if (unlikely(page->index > end))
1677 continue;
1678
1679 if (ino && ino_of_node(page) == ino) { 1660 if (ino && ino_of_node(page) == ino) {
1680 f2fs_wait_on_page_writeback(page, NODE, true); 1661 f2fs_wait_on_page_writeback(page, NODE, true);
1681 if (TestClearPageError(page)) 1662 if (TestClearPageError(page))