diff options
author | Andy Grover <agrover@redhat.com> | 2013-05-16 13:40:58 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2013-06-14 03:04:43 -0400 |
commit | 3c8a6228d078553e32bffc59ed180d01ab1d998a (patch) | |
tree | d5a7bbc0ae4171237ca4b9d9004eddf6a3536676 /drivers/target | |
parent | 0607decdca51ee33c2caae288a44a82455149b51 (diff) |
target: Unify __core_scsi3_update_aptpl_buf and core_scsi3_update_aptpl_buf
The __ version is only ever called from the regular version, so just
inline it. It's not too much more complex to handle both spinlocks in the
same function.
Signed-off-by: Andy Grover <agrover@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target')
-rw-r--r-- | drivers/target/target_core_pr.c | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c index 2e10014c8c33..548fc2a4a7bf 100644 --- a/drivers/target/target_core_pr.c +++ b/drivers/target/target_core_pr.c | |||
@@ -1828,10 +1828,7 @@ out: | |||
1828 | return ret; | 1828 | return ret; |
1829 | } | 1829 | } |
1830 | 1830 | ||
1831 | /* | 1831 | static int core_scsi3_update_aptpl_buf( |
1832 | * Called with struct se_device->dev_reservation_lock held | ||
1833 | */ | ||
1834 | static int __core_scsi3_update_aptpl_buf( | ||
1835 | struct se_device *dev, | 1832 | struct se_device *dev, |
1836 | unsigned char *buf, | 1833 | unsigned char *buf, |
1837 | u32 pr_aptpl_buf_len) | 1834 | u32 pr_aptpl_buf_len) |
@@ -1842,13 +1839,15 @@ static int __core_scsi3_update_aptpl_buf( | |||
1842 | unsigned char tmp[512], isid_buf[32]; | 1839 | unsigned char tmp[512], isid_buf[32]; |
1843 | ssize_t len = 0; | 1840 | ssize_t len = 0; |
1844 | int reg_count = 0; | 1841 | int reg_count = 0; |
1842 | int ret = 0; | ||
1845 | 1843 | ||
1846 | memset(buf, 0, pr_aptpl_buf_len); | 1844 | memset(buf, 0, pr_aptpl_buf_len); |
1847 | 1845 | ||
1846 | spin_lock(&dev->dev_reservation_lock); | ||
1847 | spin_lock(&dev->t10_pr.registration_lock); | ||
1848 | /* | 1848 | /* |
1849 | * Walk the registration list.. | 1849 | * Walk the registration list.. |
1850 | */ | 1850 | */ |
1851 | spin_lock(&dev->t10_pr.registration_lock); | ||
1852 | list_for_each_entry(pr_reg, &dev->t10_pr.registration_list, | 1851 | list_for_each_entry(pr_reg, &dev->t10_pr.registration_list, |
1853 | pr_reg_list) { | 1852 | pr_reg_list) { |
1854 | 1853 | ||
@@ -1894,8 +1893,8 @@ static int __core_scsi3_update_aptpl_buf( | |||
1894 | if ((len + strlen(tmp) >= pr_aptpl_buf_len)) { | 1893 | if ((len + strlen(tmp) >= pr_aptpl_buf_len)) { |
1895 | pr_err("Unable to update renaming" | 1894 | pr_err("Unable to update renaming" |
1896 | " APTPL metadata\n"); | 1895 | " APTPL metadata\n"); |
1897 | spin_unlock(&dev->t10_pr.registration_lock); | 1896 | ret = -EMSGSIZE; |
1898 | return -EMSGSIZE; | 1897 | goto out; |
1899 | } | 1898 | } |
1900 | len += sprintf(buf+len, "%s", tmp); | 1899 | len += sprintf(buf+len, "%s", tmp); |
1901 | 1900 | ||
@@ -1912,29 +1911,18 @@ static int __core_scsi3_update_aptpl_buf( | |||
1912 | if ((len + strlen(tmp) >= pr_aptpl_buf_len)) { | 1911 | if ((len + strlen(tmp) >= pr_aptpl_buf_len)) { |
1913 | pr_err("Unable to update renaming" | 1912 | pr_err("Unable to update renaming" |
1914 | " APTPL metadata\n"); | 1913 | " APTPL metadata\n"); |
1915 | spin_unlock(&dev->t10_pr.registration_lock); | 1914 | ret = -EMSGSIZE; |
1916 | return -EMSGSIZE; | 1915 | goto out; |
1917 | } | 1916 | } |
1918 | len += sprintf(buf+len, "%s", tmp); | 1917 | len += sprintf(buf+len, "%s", tmp); |
1919 | reg_count++; | 1918 | reg_count++; |
1920 | } | 1919 | } |
1921 | spin_unlock(&dev->t10_pr.registration_lock); | ||
1922 | 1920 | ||
1923 | if (!reg_count) | 1921 | if (!reg_count) |
1924 | len += sprintf(buf+len, "No Registrations or Reservations"); | 1922 | len += sprintf(buf+len, "No Registrations or Reservations"); |
1925 | 1923 | ||
1926 | return 0; | 1924 | out: |
1927 | } | 1925 | spin_unlock(&dev->t10_pr.registration_lock); |
1928 | |||
1929 | static int core_scsi3_update_aptpl_buf( | ||
1930 | struct se_device *dev, | ||
1931 | unsigned char *buf, | ||
1932 | u32 pr_aptpl_buf_len) | ||
1933 | { | ||
1934 | int ret; | ||
1935 | |||
1936 | spin_lock(&dev->dev_reservation_lock); | ||
1937 | ret = __core_scsi3_update_aptpl_buf(dev, buf, pr_aptpl_buf_len); | ||
1938 | spin_unlock(&dev->dev_reservation_lock); | 1926 | spin_unlock(&dev->dev_reservation_lock); |
1939 | 1927 | ||
1940 | return ret; | 1928 | return ret; |