dm.c (8dd87f3c5283de7f95396a236e420487226f3951) | dm.c (701510875975ed7e188566de205990d29f34c8d8) |
---|---|
1/* 2 * Copyright (C) 2001, 2002 Sistina Software (UK) Limited. 3 * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. 4 * 5 * This file is released under the GPL. 6 */ 7 8#include "dm-core.h" --- 3064 unchanged lines hidden (view full) --- 3073} 3074 3075struct dm_pr { 3076 u64 old_key; 3077 u64 new_key; 3078 u32 flags; 3079 bool fail_early; 3080 int ret; | 1/* 2 * Copyright (C) 2001, 2002 Sistina Software (UK) Limited. 3 * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. 4 * 5 * This file is released under the GPL. 6 */ 7 8#include "dm-core.h" --- 3064 unchanged lines hidden (view full) --- 3073} 3074 3075struct dm_pr { 3076 u64 old_key; 3077 u64 new_key; 3078 u32 flags; 3079 bool fail_early; 3080 int ret; |
3081 enum pr_type type; |
|
3081}; 3082 3083static int dm_call_pr(struct block_device *bdev, iterate_devices_callout_fn fn, 3084 struct dm_pr *pr) 3085{ 3086 struct mapped_device *md = bdev->bd_disk->private_data; 3087 struct dm_table *table; 3088 struct dm_target *ti; --- 81 unchanged lines hidden (view full) --- 3170 pr.old_key = new_key; 3171 pr.new_key = 0; 3172 pr.flags = 0; 3173 pr.fail_early = false; 3174 (void) dm_call_pr(bdev, __dm_pr_register, &pr); 3175 return ret; 3176} 3177 | 3082}; 3083 3084static int dm_call_pr(struct block_device *bdev, iterate_devices_callout_fn fn, 3085 struct dm_pr *pr) 3086{ 3087 struct mapped_device *md = bdev->bd_disk->private_data; 3088 struct dm_table *table; 3089 struct dm_target *ti; --- 81 unchanged lines hidden (view full) --- 3171 pr.old_key = new_key; 3172 pr.new_key = 0; 3173 pr.flags = 0; 3174 pr.fail_early = false; 3175 (void) dm_call_pr(bdev, __dm_pr_register, &pr); 3176 return ret; 3177} 3178 |
3179 3180static int __dm_pr_reserve(struct dm_target *ti, struct dm_dev *dev, 3181 sector_t start, sector_t len, void *data) 3182{ 3183 struct dm_pr *pr = data; 3184 const struct pr_ops *ops = dev->bdev->bd_disk->fops->pr_ops; 3185 3186 if (!ops || !ops->pr_reserve) { 3187 pr->ret = -EOPNOTSUPP; 3188 return -1; 3189 } 3190 3191 pr->ret = ops->pr_reserve(dev->bdev, pr->old_key, pr->type, pr->flags); 3192 if (!pr->ret) 3193 return -1; 3194 3195 return 0; 3196} 3197 |
|
3178static int dm_pr_reserve(struct block_device *bdev, u64 key, enum pr_type type, 3179 u32 flags) 3180{ | 3198static int dm_pr_reserve(struct block_device *bdev, u64 key, enum pr_type type, 3199 u32 flags) 3200{ |
3181 struct mapped_device *md = bdev->bd_disk->private_data; 3182 const struct pr_ops *ops; 3183 int r, srcu_idx; | 3201 struct dm_pr pr = { 3202 .old_key = key, 3203 .flags = flags, 3204 .type = type, 3205 .fail_early = false, 3206 .ret = 0, 3207 }; 3208 int ret; |
3184 | 3209 |
3185 r = dm_prepare_ioctl(md, &srcu_idx, &bdev); 3186 if (r < 0) 3187 goto out; | 3210 ret = dm_call_pr(bdev, __dm_pr_reserve, &pr); 3211 if (ret) 3212 return ret; |
3188 | 3213 |
3189 ops = bdev->bd_disk->fops->pr_ops; 3190 if (ops && ops->pr_reserve) 3191 r = ops->pr_reserve(bdev, key, type, flags); 3192 else 3193 r = -EOPNOTSUPP; 3194out: 3195 dm_unprepare_ioctl(md, srcu_idx); 3196 return r; | 3214 return pr.ret; |
3197} 3198 3199static int dm_pr_release(struct block_device *bdev, u64 key, enum pr_type type) 3200{ 3201 struct mapped_device *md = bdev->bd_disk->private_data; 3202 const struct pr_ops *ops; 3203 int r, srcu_idx; 3204 --- 111 unchanged lines hidden --- | 3215} 3216 3217static int dm_pr_release(struct block_device *bdev, u64 key, enum pr_type type) 3218{ 3219 struct mapped_device *md = bdev->bd_disk->private_data; 3220 const struct pr_ops *ops; 3221 int r, srcu_idx; 3222 --- 111 unchanged lines hidden --- |