dm-thin.c (58f77a2196ee65510885426e65049880be841193) dm-thin.c (55a62eef8d1b50ceff3b7bf46851103bdcc7e5b0)
1/*
2 * Copyright (C) 2011-2012 Red Hat UK.
3 *
4 * This file is released under the GPL.
5 */
6
7#include "dm-thin-metadata.h"
8#include "dm-bio-prison.h"

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

1939 }
1940
1941 pt->pool = pool;
1942 pt->ti = ti;
1943 pt->metadata_dev = metadata_dev;
1944 pt->data_dev = data_dev;
1945 pt->low_water_blocks = low_water_blocks;
1946 pt->adjusted_pf = pt->requested_pf = pf;
1/*
2 * Copyright (C) 2011-2012 Red Hat UK.
3 *
4 * This file is released under the GPL.
5 */
6
7#include "dm-thin-metadata.h"
8#include "dm-bio-prison.h"

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

1939 }
1940
1941 pt->pool = pool;
1942 pt->ti = ti;
1943 pt->metadata_dev = metadata_dev;
1944 pt->data_dev = data_dev;
1945 pt->low_water_blocks = low_water_blocks;
1946 pt->adjusted_pf = pt->requested_pf = pf;
1947 ti->num_flush_requests = 1;
1947 ti->num_flush_bios = 1;
1948
1949 /*
1950 * Only need to enable discards if the pool should pass
1951 * them down to the data device. The thin device's discard
1952 * processing will cause mappings to be removed from the btree.
1953 */
1954 if (pf.discard_enabled && pf.discard_passdown) {
1948
1949 /*
1950 * Only need to enable discards if the pool should pass
1951 * them down to the data device. The thin device's discard
1952 * processing will cause mappings to be removed from the btree.
1953 */
1954 if (pf.discard_enabled && pf.discard_passdown) {
1955 ti->num_discard_requests = 1;
1955 ti->num_discard_bios = 1;
1956
1957 /*
1958 * Setting 'discards_supported' circumvents the normal
1959 * stacking of discard limits (this keeps the pool and
1960 * thin devices' discard limits consistent).
1961 */
1962 ti->discards_supported = true;
1963 ti->discard_zeroes_data_unsupported = true;

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

2588 ti->error = "Couldn't open thin internal device";
2589 goto bad_thin_open;
2590 }
2591
2592 r = dm_set_target_max_io_len(ti, tc->pool->sectors_per_block);
2593 if (r)
2594 goto bad_thin_open;
2595
1956
1957 /*
1958 * Setting 'discards_supported' circumvents the normal
1959 * stacking of discard limits (this keeps the pool and
1960 * thin devices' discard limits consistent).
1961 */
1962 ti->discards_supported = true;
1963 ti->discard_zeroes_data_unsupported = true;

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

2588 ti->error = "Couldn't open thin internal device";
2589 goto bad_thin_open;
2590 }
2591
2592 r = dm_set_target_max_io_len(ti, tc->pool->sectors_per_block);
2593 if (r)
2594 goto bad_thin_open;
2595
2596 ti->num_flush_requests = 1;
2596 ti->num_flush_bios = 1;
2597 ti->flush_supported = true;
2598 ti->per_bio_data_size = sizeof(struct dm_thin_endio_hook);
2599
2600 /* In case the pool supports discards, pass them on. */
2601 if (tc->pool->pf.discard_enabled) {
2602 ti->discards_supported = true;
2597 ti->flush_supported = true;
2598 ti->per_bio_data_size = sizeof(struct dm_thin_endio_hook);
2599
2600 /* In case the pool supports discards, pass them on. */
2601 if (tc->pool->pf.discard_enabled) {
2602 ti->discards_supported = true;
2603 ti->num_discard_requests = 1;
2603 ti->num_discard_bios = 1;
2604 ti->discard_zeroes_data_unsupported = true;
2604 ti->discard_zeroes_data_unsupported = true;
2605 /* Discard requests must be split on a block boundary */
2606 ti->split_discard_requests = true;
2605 /* Discard bios must be split on a block boundary */
2606 ti->split_discard_bios = true;
2607 }
2608
2609 dm_put(pool_md);
2610
2611 mutex_unlock(&dm_thin_pool_table.mutex);
2612
2613 return 0;
2614

--- 205 unchanged lines hidden ---
2607 }
2608
2609 dm_put(pool_md);
2610
2611 mutex_unlock(&dm_thin_pool_table.mutex);
2612
2613 return 0;
2614

--- 205 unchanged lines hidden ---