dir.c (cebeb0f1885fa93c44be5d4e0b9b640210ff088c) | dir.c (817202d937e6cca7e60f42e6495aaa51d70d9d7e) |
---|---|
1/* 2 * fs/f2fs/dir.c 3 * 4 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 5 * http://www.samsung.com/ 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License version 2 as --- 623 unchanged lines hidden (view full) --- 632static int f2fs_readdir(struct file *file, struct dir_context *ctx) 633{ 634 struct inode *inode = file_inode(file); 635 unsigned long npages = dir_blocks(inode); 636 unsigned int bit_pos = 0; 637 struct f2fs_dentry_block *dentry_blk = NULL; 638 struct f2fs_dir_entry *de = NULL; 639 struct page *dentry_page = NULL; | 1/* 2 * fs/f2fs/dir.c 3 * 4 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 5 * http://www.samsung.com/ 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License version 2 as --- 623 unchanged lines hidden (view full) --- 632static int f2fs_readdir(struct file *file, struct dir_context *ctx) 633{ 634 struct inode *inode = file_inode(file); 635 unsigned long npages = dir_blocks(inode); 636 unsigned int bit_pos = 0; 637 struct f2fs_dentry_block *dentry_blk = NULL; 638 struct f2fs_dir_entry *de = NULL; 639 struct page *dentry_page = NULL; |
640 struct file_ra_state *ra = &file->f_ra; |
|
640 unsigned int n = ((unsigned long)ctx->pos / NR_DENTRY_IN_BLOCK); 641 unsigned char d_type = DT_UNKNOWN; 642 643 bit_pos = ((unsigned long)ctx->pos % NR_DENTRY_IN_BLOCK); 644 | 641 unsigned int n = ((unsigned long)ctx->pos / NR_DENTRY_IN_BLOCK); 642 unsigned char d_type = DT_UNKNOWN; 643 644 bit_pos = ((unsigned long)ctx->pos % NR_DENTRY_IN_BLOCK); 645 |
646 /* readahead for multi pages of dir */ 647 if (npages - n > 1 && !ra_has_index(ra, n)) 648 page_cache_sync_readahead(inode->i_mapping, ra, file, n, 649 min(npages - n, (pgoff_t)MAX_DIR_RA_PAGES)); 650 |
|
645 for (; n < npages; n++) { 646 dentry_page = get_lock_data_page(inode, n); 647 if (IS_ERR(dentry_page)) 648 continue; 649 650 dentry_blk = kmap(dentry_page); 651 while (bit_pos < NR_DENTRY_IN_BLOCK) { 652 bit_pos = find_next_bit_le(&dentry_blk->dentry_bitmap, --- 41 unchanged lines hidden --- | 651 for (; n < npages; n++) { 652 dentry_page = get_lock_data_page(inode, n); 653 if (IS_ERR(dentry_page)) 654 continue; 655 656 dentry_blk = kmap(dentry_page); 657 while (bit_pos < NR_DENTRY_IN_BLOCK) { 658 bit_pos = find_next_bit_le(&dentry_blk->dentry_bitmap, --- 41 unchanged lines hidden --- |