aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-08-28 12:52:22 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-09-26 22:20:08 -0400
commit2903ff019b346ab8d36ebbf54853c3aaf6590608 (patch)
tree962d94054765bb37bc00e977c3036e65c5fd91fe /fs/ocfs2
parenta5b470ba06aa3f96999ede5feba178df6bdb134a (diff)
switch simple cases of fget_light to fdget
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r--fs/ocfs2/cluster/heartbeat.c39
1 files changed, 19 insertions, 20 deletions
diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
index 61c28ae266f5..f7c648d7d6bf 100644
--- a/fs/ocfs2/cluster/heartbeat.c
+++ b/fs/ocfs2/cluster/heartbeat.c
@@ -1746,11 +1746,10 @@ static ssize_t o2hb_region_dev_write(struct o2hb_region *reg,
1746 long fd; 1746 long fd;
1747 int sectsize; 1747 int sectsize;
1748 char *p = (char *)page; 1748 char *p = (char *)page;
1749 struct file *filp = NULL; 1749 struct fd f;
1750 struct inode *inode = NULL; 1750 struct inode *inode;
1751 ssize_t ret = -EINVAL; 1751 ssize_t ret = -EINVAL;
1752 int live_threshold; 1752 int live_threshold;
1753 int fput_needed;
1754 1753
1755 if (reg->hr_bdev) 1754 if (reg->hr_bdev)
1756 goto out; 1755 goto out;
@@ -1767,26 +1766,26 @@ static ssize_t o2hb_region_dev_write(struct o2hb_region *reg,
1767 if (fd < 0 || fd >= INT_MAX) 1766 if (fd < 0 || fd >= INT_MAX)
1768 goto out; 1767 goto out;
1769 1768
1770 filp = fget_light(fd, &fput_needed); 1769 f = fdget(fd);
1771 if (filp == NULL) 1770 if (f.file == NULL)
1772 goto out; 1771 goto out;
1773 1772
1774 if (reg->hr_blocks == 0 || reg->hr_start_block == 0 || 1773 if (reg->hr_blocks == 0 || reg->hr_start_block == 0 ||
1775 reg->hr_block_bytes == 0) 1774 reg->hr_block_bytes == 0)
1776 goto out; 1775 goto out2;
1777 1776
1778 inode = igrab(filp->f_mapping->host); 1777 inode = igrab(f.file->f_mapping->host);
1779 if (inode == NULL) 1778 if (inode == NULL)
1780 goto out; 1779 goto out2;
1781 1780
1782 if (!S_ISBLK(inode->i_mode)) 1781 if (!S_ISBLK(inode->i_mode))
1783 goto out; 1782 goto out3;
1784 1783
1785 reg->hr_bdev = I_BDEV(filp->f_mapping->host); 1784 reg->hr_bdev = I_BDEV(f.file->f_mapping->host);
1786 ret = blkdev_get(reg->hr_bdev, FMODE_WRITE | FMODE_READ, NULL); 1785 ret = blkdev_get(reg->hr_bdev, FMODE_WRITE | FMODE_READ, NULL);
1787 if (ret) { 1786 if (ret) {
1788 reg->hr_bdev = NULL; 1787 reg->hr_bdev = NULL;
1789 goto out; 1788 goto out3;
1790 } 1789 }
1791 inode = NULL; 1790 inode = NULL;
1792 1791
@@ -1798,7 +1797,7 @@ static ssize_t o2hb_region_dev_write(struct o2hb_region *reg,
1798 "blocksize %u incorrect for device, expected %d", 1797 "blocksize %u incorrect for device, expected %d",
1799 reg->hr_block_bytes, sectsize); 1798 reg->hr_block_bytes, sectsize);
1800 ret = -EINVAL; 1799 ret = -EINVAL;
1801 goto out; 1800 goto out3;
1802 } 1801 }
1803 1802
1804 o2hb_init_region_params(reg); 1803 o2hb_init_region_params(reg);
@@ -1812,13 +1811,13 @@ static ssize_t o2hb_region_dev_write(struct o2hb_region *reg,
1812 ret = o2hb_map_slot_data(reg); 1811 ret = o2hb_map_slot_data(reg);
1813 if (ret) { 1812 if (ret) {
1814 mlog_errno(ret); 1813 mlog_errno(ret);
1815 goto out; 1814 goto out3;
1816 } 1815 }
1817 1816
1818 ret = o2hb_populate_slot_data(reg); 1817 ret = o2hb_populate_slot_data(reg);
1819 if (ret) { 1818 if (ret) {
1820 mlog_errno(ret); 1819 mlog_errno(ret);
1821 goto out; 1820 goto out3;
1822 } 1821 }
1823 1822
1824 INIT_DELAYED_WORK(&reg->hr_write_timeout_work, o2hb_write_timeout); 1823 INIT_DELAYED_WORK(&reg->hr_write_timeout_work, o2hb_write_timeout);
@@ -1848,7 +1847,7 @@ static ssize_t o2hb_region_dev_write(struct o2hb_region *reg,
1848 if (IS_ERR(hb_task)) { 1847 if (IS_ERR(hb_task)) {
1849 ret = PTR_ERR(hb_task); 1848 ret = PTR_ERR(hb_task);
1850 mlog_errno(ret); 1849 mlog_errno(ret);
1851 goto out; 1850 goto out3;
1852 } 1851 }
1853 1852
1854 spin_lock(&o2hb_live_lock); 1853 spin_lock(&o2hb_live_lock);
@@ -1864,7 +1863,7 @@ static ssize_t o2hb_region_dev_write(struct o2hb_region *reg,
1864 1863
1865 if (reg->hr_aborted_start) { 1864 if (reg->hr_aborted_start) {
1866 ret = -EIO; 1865 ret = -EIO;
1867 goto out; 1866 goto out3;
1868 } 1867 }
1869 1868
1870 /* Ok, we were woken. Make sure it wasn't by drop_item() */ 1869 /* Ok, we were woken. Make sure it wasn't by drop_item() */
@@ -1883,11 +1882,11 @@ static ssize_t o2hb_region_dev_write(struct o2hb_region *reg,
1883 printk(KERN_NOTICE "o2hb: Heartbeat started on region %s (%s)\n", 1882 printk(KERN_NOTICE "o2hb: Heartbeat started on region %s (%s)\n",
1884 config_item_name(&reg->hr_item), reg->hr_dev_name); 1883 config_item_name(&reg->hr_item), reg->hr_dev_name);
1885 1884
1885out3:
1886 iput(inode);
1887out2:
1888 fdput(f);
1886out: 1889out:
1887 if (filp)
1888 fput_light(filp, fput_needed);
1889 if (inode)
1890 iput(inode);
1891 if (ret < 0) { 1890 if (ret < 0) {
1892 if (reg->hr_bdev) { 1891 if (reg->hr_bdev) {
1893 blkdev_put(reg->hr_bdev, FMODE_READ|FMODE_WRITE); 1892 blkdev_put(reg->hr_bdev, FMODE_READ|FMODE_WRITE);