ioctl.c (bbb651e469d99f0088e286fdeb54acca7bb4ad4e) ioctl.c (c1c9ff7c94e83fae89a742df74db51156869bad5)
1/*
2 * Copyright (C) 2007 Oracle. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public
6 * License v2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,

--- 1407 unchanged lines hidden (view full) ---

1416 sizestr = devstr + 1;
1417 *devstr = '\0';
1418 devstr = vol_args->name;
1419 devid = simple_strtoull(devstr, &end, 10);
1420 if (!devid) {
1421 ret = -EINVAL;
1422 goto out_free;
1423 }
1/*
2 * Copyright (C) 2007 Oracle. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public
6 * License v2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,

--- 1407 unchanged lines hidden (view full) ---

1416 sizestr = devstr + 1;
1417 *devstr = '\0';
1418 devstr = vol_args->name;
1419 devid = simple_strtoull(devstr, &end, 10);
1420 if (!devid) {
1421 ret = -EINVAL;
1422 goto out_free;
1423 }
1424 printk(KERN_INFO "btrfs: resizing devid %llu\n",
1425 (unsigned long long)devid);
1424 printk(KERN_INFO "btrfs: resizing devid %llu\n", devid);
1426 }
1427
1428 device = btrfs_find_device(root->fs_info, devid, NULL, NULL);
1429 if (!device) {
1430 printk(KERN_INFO "btrfs: resizer unable to find device %llu\n",
1425 }
1426
1427 device = btrfs_find_device(root->fs_info, devid, NULL, NULL);
1428 if (!device) {
1429 printk(KERN_INFO "btrfs: resizer unable to find device %llu\n",
1431 (unsigned long long)devid);
1430 devid);
1432 ret = -ENODEV;
1433 goto out_free;
1434 }
1435
1436 if (!device->writeable) {
1437 printk(KERN_INFO "btrfs: resizer unable to apply on "
1438 "readonly device %llu\n",
1431 ret = -ENODEV;
1432 goto out_free;
1433 }
1434
1435 if (!device->writeable) {
1436 printk(KERN_INFO "btrfs: resizer unable to apply on "
1437 "readonly device %llu\n",
1439 (unsigned long long)devid);
1438 devid);
1440 ret = -EPERM;
1441 goto out_free;
1442 }
1443
1444 if (!strcmp(sizestr, "max"))
1445 new_size = device->bdev->bd_inode->i_size;
1446 else {
1447 if (sizestr[0] == '-') {

--- 35 unchanged lines hidden (view full) ---

1483 ret = -EFBIG;
1484 goto out_free;
1485 }
1486
1487 do_div(new_size, root->sectorsize);
1488 new_size *= root->sectorsize;
1489
1490 printk_in_rcu(KERN_INFO "btrfs: new size for %s is %llu\n",
1439 ret = -EPERM;
1440 goto out_free;
1441 }
1442
1443 if (!strcmp(sizestr, "max"))
1444 new_size = device->bdev->bd_inode->i_size;
1445 else {
1446 if (sizestr[0] == '-') {

--- 35 unchanged lines hidden (view full) ---

1482 ret = -EFBIG;
1483 goto out_free;
1484 }
1485
1486 do_div(new_size, root->sectorsize);
1487 new_size *= root->sectorsize;
1488
1489 printk_in_rcu(KERN_INFO "btrfs: new size for %s is %llu\n",
1491 rcu_str_deref(device->name),
1492 (unsigned long long)new_size);
1490 rcu_str_deref(device->name), new_size);
1493
1494 if (new_size > old_size) {
1495 trans = btrfs_start_transaction(root, 0);
1496 if (IS_ERR(trans)) {
1497 ret = PTR_ERR(trans);
1498 goto out_free;
1499 }
1500 ret = btrfs_grow_device(trans, device, new_size);

--- 3103 unchanged lines hidden ---
1491
1492 if (new_size > old_size) {
1493 trans = btrfs_start_transaction(root, 0);
1494 if (IS_ERR(trans)) {
1495 ret = PTR_ERR(trans);
1496 goto out_free;
1497 }
1498 ret = btrfs_grow_device(trans, device, new_size);

--- 3103 unchanged lines hidden ---