Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 156078
b: refs/heads/master
c: dddac6a
h: refs/heads/master
v: v3
  • Loading branch information
Alan Jenkins authored and Rafael J. Wysocki committed Jul 29, 2009
1 parent e4adda6 commit 13b2b52
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ec79be26875f6c1468784876cb99192b7f41c7a5
refs/heads/master: dddac6a7b445de95515f64fdf82fe5dc36c02f26
10 changes: 10 additions & 0 deletions trunk/fs/block_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,16 @@ struct block_device *bdget(dev_t dev)

EXPORT_SYMBOL(bdget);

/**
* bdgrab -- Grab a reference to an already referenced block device
* @bdev: Block device to grab a reference to.
*/
struct block_device *bdgrab(struct block_device *bdev)
{
atomic_inc(&bdev->bd_inode->i_count);
return bdev;
}

long nr_blockdev_pages(void)
{
struct block_device *bdev;
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1946,6 +1946,7 @@ extern void putname(const char *name);
extern int register_blkdev(unsigned int, const char *);
extern void unregister_blkdev(unsigned int, const char *);
extern struct block_device *bdget(dev_t);
extern struct block_device *bdgrab(struct block_device *bdev);
extern void bd_set_size(struct block_device *, loff_t size);
extern void bd_forget(struct inode *inode);
extern void bdput(struct block_device *);
Expand Down
4 changes: 2 additions & 2 deletions trunk/mm/swapfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ int swap_type_of(dev_t device, sector_t offset, struct block_device **bdev_p)

if (!bdev) {
if (bdev_p)
*bdev_p = bdget(sis->bdev->bd_dev);
*bdev_p = bdgrab(sis->bdev);

spin_unlock(&swap_lock);
return i;
Expand All @@ -765,7 +765,7 @@ int swap_type_of(dev_t device, sector_t offset, struct block_device **bdev_p)
struct swap_extent, list);
if (se->start_block == offset) {
if (bdev_p)
*bdev_p = bdget(sis->bdev->bd_dev);
*bdev_p = bdgrab(sis->bdev);

spin_unlock(&swap_lock);
bdput(bdev);
Expand Down

0 comments on commit 13b2b52

Please sign in to comment.