Small cleanup: don't do anything if on resync_size command size of the device remained the same

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1091 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2009-09-14 17:47:47 +00:00
parent 4decd55808
commit e25dd44fad

View File

@@ -426,7 +426,7 @@ static struct file *vdisk_open(const struct scst_vdisk_dev *virt_dev)
*
* Description:
*************************************************************/
static int vdisk_get_check_file_size(const char *file_name, bool blockio,
static int vdisk_get_file_size(const char *file_name, bool blockio,
loff_t *file_size)
{
struct inode *inode;
@@ -543,7 +543,7 @@ static int vdisk_attach(struct scst_device *dev)
if (virt_dev->nullio)
err = VDISK_NULLIO_SIZE;
else {
res = vdisk_get_check_file_size(virt_dev->file_name,
res = vdisk_get_file_size(virt_dev->file_name,
virt_dev->blockio, &err);
if (res != 0)
goto out;
@@ -2839,22 +2839,28 @@ static void vdisk_report_registering(const char *type,
/* scst_vdisk_mutex supposed to be held */
static int vdisk_resync_size(struct scst_vdisk_dev *virt_dev)
{
loff_t err;
loff_t file_size;
int res = 0;
if (!virt_dev->nullio) {
res = vdisk_get_check_file_size(virt_dev->file_name,
virt_dev->blockio, &err);
res = vdisk_get_file_size(virt_dev->file_name,
virt_dev->blockio, &file_size);
if (res != 0)
goto out;
} else
err = VDISK_NULLIO_SIZE;
file_size = VDISK_NULLIO_SIZE;
if (file_size == virt_dev->file_size) {
PRINT_INFO("Size of virtual disk %s remained the same",
virt_dev->name);
goto out;
}
res = scst_suspend_activity(true);
if (res != 0)
goto out;
virt_dev->file_size = err;
virt_dev->file_size = file_size;
virt_dev->nblocks = virt_dev->file_size >> virt_dev->block_shift;
scst_dev_del_all_thr_data(virt_dev->dev);
@@ -3340,7 +3346,7 @@ static int vcdrom_change(char *p, char *name)
strncpy(fn, file_name, len);
virt_dev->file_name = fn;
res = vdisk_get_check_file_size(virt_dev->file_name,
res = vdisk_get_file_size(virt_dev->file_name,
virt_dev->blockio, &err);
if (res != 0)
goto out_free;