Lines Matching defs:device
1220 /* Skip any superblocks on this device. */
1282 * Avoid races with device replace and make sure our bbio has devices
1291 /* Tell the block device(s) that the sectors can be discarded */
1306 struct btrfs_device *device = stripe->dev;
1308 if (!device->bdev) {
1312 req_q = bdev_get_queue(device->bdev);
1316 if (!test_bit(BTRFS_DEV_STATE_WRITEABLE, &device->dev_state))
1319 ret = btrfs_issue_discard(device->bdev,
5729 static int btrfs_trim_free_extents(struct btrfs_device *device, u64 *trimmed)
5737 if (!blk_queue_discard(bdev_get_queue(device->bdev)))
5741 if (!test_bit(BTRFS_DEV_STATE_WRITEABLE, &device->dev_state))
5745 if (device->total_bytes <= device->bytes_used)
5751 struct btrfs_fs_info *fs_info = device->fs_info;
5758 find_first_clear_extent_bit(&device->alloc_state, start,
5763 if (start > device->total_bytes) {
5766 "ignoring attempt to trim beyond device size: offset %llu length %llu device %s device size %llu",
5768 rcu_str_deref(device->name),
5769 device->total_bytes);
5780 * end of the device it will set end to -1, in this case it's up
5781 * to the caller to trim the value to the size of the device.
5783 end = min(end, device->total_bytes - 1);
5794 ret = btrfs_issue_discard(device->bdev, start, len,
5797 set_extent_bits(&device->alloc_state, start,
5822 * 2) trimming the unallocated space on each device
5824 * This will also continue trimming even if a block group or device encounters
5831 struct btrfs_device *device;
5898 list_for_each_entry(device, devices, dev_list) {
5899 if (test_bit(BTRFS_DEV_STATE_MISSING, &device->dev_state))
5902 ret = btrfs_trim_free_extents(device, &group_trimmed);
5915 "failed to trim %llu device(s), last error %d",