Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'for-linus' of git://github.com/prasad-joshi/logfs_upstream

Pull LogFS bugfixes from Prasad Joshi:

- "logfs: query block device for number of pages to send with bio"

This BUG was found when LogFS was used on KVM. The patch fixes
the problem by asking for underlaying block device the number
of pages to send with each BIO.

- "logfs: maintain the ordering of meta-inode destruction"

LogFS maintains file system meta-data in special inodes. These
inodes are releated to each other, therefore they must be
destroyed in a proper order.

- "logfs: initialize the number of iovecs in bio"

LogFS used to panic when it was created on an encrypted LVM
volume. The patch fixes the problem by properly initializing
the BIO.

Plus a couple more:
- logfs: create a pagecache page if it is not present
- logfs: destroy the reserved inodes while unmounting

* tag 'for-linus' of git://github.com/prasad-joshi/logfs_upstream:
logfs: query block device for number of pages to send with bio
logfs: maintain the ordering of meta-inode destruction
logfs: create a pagecache page if it is not present
logfs: initialize the number of iovecs in bio
logfs: destroy the reserved inodes while unmounting

+26 -12
+7 -8
fs/logfs/dev_bdev.c
··· 26 26 struct completion complete; 27 27 28 28 bio_init(&bio); 29 + bio.bi_max_vecs = 1; 29 30 bio.bi_io_vec = &bio_vec; 30 31 bio_vec.bv_page = page; 31 32 bio_vec.bv_len = PAGE_SIZE; ··· 96 95 struct address_space *mapping = super->s_mapping_inode->i_mapping; 97 96 struct bio *bio; 98 97 struct page *page; 99 - struct request_queue *q = bdev_get_queue(sb->s_bdev); 100 - unsigned int max_pages = queue_max_hw_sectors(q) >> (PAGE_SHIFT - 9); 98 + unsigned int max_pages; 101 99 int i; 102 100 103 - if (max_pages > BIO_MAX_PAGES) 104 - max_pages = BIO_MAX_PAGES; 101 + max_pages = min(nr_pages, (size_t) bio_get_nr_vecs(super->s_bdev)); 102 + 105 103 bio = bio_alloc(GFP_NOFS, max_pages); 106 104 BUG_ON(!bio); 107 105 ··· 190 190 { 191 191 struct logfs_super *super = logfs_super(sb); 192 192 struct bio *bio; 193 - struct request_queue *q = bdev_get_queue(sb->s_bdev); 194 - unsigned int max_pages = queue_max_hw_sectors(q) >> (PAGE_SHIFT - 9); 193 + unsigned int max_pages; 195 194 int i; 196 195 197 - if (max_pages > BIO_MAX_PAGES) 198 - max_pages = BIO_MAX_PAGES; 196 + max_pages = min(nr_pages, (size_t) bio_get_nr_vecs(super->s_bdev)); 197 + 199 198 bio = bio_alloc(GFP_NOFS, max_pages); 200 199 BUG_ON(!bio); 201 200
+17 -1
fs/logfs/inode.c
··· 156 156 call_rcu(&inode->i_rcu, logfs_i_callback); 157 157 } 158 158 159 + static void __logfs_destroy_meta_inode(struct inode *inode) 160 + { 161 + struct logfs_inode *li = logfs_inode(inode); 162 + BUG_ON(li->li_block); 163 + call_rcu(&inode->i_rcu, logfs_i_callback); 164 + } 165 + 159 166 static void logfs_destroy_inode(struct inode *inode) 160 167 { 161 168 struct logfs_inode *li = logfs_inode(inode); 169 + 170 + if (inode->i_ino < LOGFS_RESERVED_INOS) { 171 + /* 172 + * The reserved inodes are never destroyed unless we are in 173 + * unmont path. 174 + */ 175 + __logfs_destroy_meta_inode(inode); 176 + return; 177 + } 162 178 163 179 BUG_ON(list_empty(&li->li_freeing_list)); 164 180 spin_lock(&logfs_inode_lock); ··· 389 373 { 390 374 struct logfs_super *super = logfs_super(sb); 391 375 /* kill the meta-inodes */ 392 - iput(super->s_master_inode); 393 376 iput(super->s_segfile_inode); 377 + iput(super->s_master_inode); 394 378 iput(super->s_mapping_inode); 395 379 } 396 380
+1 -1
fs/logfs/journal.c
··· 565 565 index = ofs >> PAGE_SHIFT; 566 566 page_ofs = ofs & (PAGE_SIZE - 1); 567 567 568 - page = find_lock_page(mapping, index); 568 + page = find_or_create_page(mapping, index, GFP_NOFS); 569 569 BUG_ON(!page); 570 570 memcpy(wbuf, page_address(page) + page_ofs, super->s_writesize); 571 571 unlock_page(page);
-1
fs/logfs/readwrite.c
··· 2189 2189 return; 2190 2190 } 2191 2191 2192 - BUG_ON(inode->i_ino < LOGFS_RESERVED_INOS); 2193 2192 page = inode_to_page(inode); 2194 2193 BUG_ON(!page); /* FIXME: Use emergency page */ 2195 2194 logfs_put_write_page(page);
+1 -1
fs/logfs/segment.c
··· 886 886 887 887 static void map_invalidatepage(struct page *page, unsigned long l) 888 888 { 889 - BUG(); 889 + return; 890 890 } 891 891 892 892 static int map_releasepage(struct page *page, gfp_t g)