Skip to content

Commit

Permalink
Merge tag 'for-linus' of git://github.com/prasad-joshi/logfs_upstream
Browse files Browse the repository at this point in the history
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
  • Loading branch information
torvalds committed Aug 26, 2012
2 parents 9acb172 + 9f0bbd8 commit 89a897f
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 12 deletions.
15 changes: 7 additions & 8 deletions fs/logfs/dev_bdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ static int sync_request(struct page *page, struct block_device *bdev, int rw)
struct completion complete;

bio_init(&bio);
bio.bi_max_vecs = 1;
bio.bi_io_vec = &bio_vec;
bio_vec.bv_page = page;
bio_vec.bv_len = PAGE_SIZE;
Expand Down Expand Up @@ -95,12 +96,11 @@ static int __bdev_writeseg(struct super_block *sb, u64 ofs, pgoff_t index,
struct address_space *mapping = super->s_mapping_inode->i_mapping;
struct bio *bio;
struct page *page;
struct request_queue *q = bdev_get_queue(sb->s_bdev);
unsigned int max_pages = queue_max_hw_sectors(q) >> (PAGE_SHIFT - 9);
unsigned int max_pages;
int i;

if (max_pages > BIO_MAX_PAGES)
max_pages = BIO_MAX_PAGES;
max_pages = min(nr_pages, (size_t) bio_get_nr_vecs(super->s_bdev));

bio = bio_alloc(GFP_NOFS, max_pages);
BUG_ON(!bio);

Expand Down Expand Up @@ -190,12 +190,11 @@ static int do_erase(struct super_block *sb, u64 ofs, pgoff_t index,
{
struct logfs_super *super = logfs_super(sb);
struct bio *bio;
struct request_queue *q = bdev_get_queue(sb->s_bdev);
unsigned int max_pages = queue_max_hw_sectors(q) >> (PAGE_SHIFT - 9);
unsigned int max_pages;
int i;

if (max_pages > BIO_MAX_PAGES)
max_pages = BIO_MAX_PAGES;
max_pages = min(nr_pages, (size_t) bio_get_nr_vecs(super->s_bdev));

bio = bio_alloc(GFP_NOFS, max_pages);
BUG_ON(!bio);

Expand Down
18 changes: 17 additions & 1 deletion fs/logfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,26 @@ static void __logfs_destroy_inode(struct inode *inode)
call_rcu(&inode->i_rcu, logfs_i_callback);
}

static void __logfs_destroy_meta_inode(struct inode *inode)
{
struct logfs_inode *li = logfs_inode(inode);
BUG_ON(li->li_block);
call_rcu(&inode->i_rcu, logfs_i_callback);
}

static void logfs_destroy_inode(struct inode *inode)
{
struct logfs_inode *li = logfs_inode(inode);

if (inode->i_ino < LOGFS_RESERVED_INOS) {
/*
* The reserved inodes are never destroyed unless we are in
* unmont path.
*/
__logfs_destroy_meta_inode(inode);
return;
}

BUG_ON(list_empty(&li->li_freeing_list));
spin_lock(&logfs_inode_lock);
li->li_refcount--;
Expand Down Expand Up @@ -373,8 +389,8 @@ static void logfs_put_super(struct super_block *sb)
{
struct logfs_super *super = logfs_super(sb);
/* kill the meta-inodes */
iput(super->s_master_inode);
iput(super->s_segfile_inode);
iput(super->s_master_inode);
iput(super->s_mapping_inode);
}

Expand Down
2 changes: 1 addition & 1 deletion fs/logfs/journal.c
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ static void write_wbuf(struct super_block *sb, struct logfs_area *area,
index = ofs >> PAGE_SHIFT;
page_ofs = ofs & (PAGE_SIZE - 1);

page = find_lock_page(mapping, index);
page = find_or_create_page(mapping, index, GFP_NOFS);
BUG_ON(!page);
memcpy(wbuf, page_address(page) + page_ofs, super->s_writesize);
unlock_page(page);
Expand Down
1 change: 0 additions & 1 deletion fs/logfs/readwrite.c
Original file line number Diff line number Diff line change
Expand Up @@ -2189,7 +2189,6 @@ void logfs_evict_inode(struct inode *inode)
return;
}

BUG_ON(inode->i_ino < LOGFS_RESERVED_INOS);
page = inode_to_page(inode);
BUG_ON(!page); /* FIXME: Use emergency page */
logfs_put_write_page(page);
Expand Down
2 changes: 1 addition & 1 deletion fs/logfs/segment.c
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ static struct logfs_area *alloc_area(struct super_block *sb)

static void map_invalidatepage(struct page *page, unsigned long l)
{
BUG();
return;
}

static int map_releasepage(struct page *page, gfp_t g)
Expand Down

0 comments on commit 89a897f

Please sign in to comment.