Commit 2c4aa049 authored by Lars Ellenberg's avatar Lars Ellenberg Committed by Philipp Reisner

more comments about gfp flags, two GFP_KERNEL -> GFP_NOIO

Signed-off-by: default avatarPhilipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: default avatarLars Ellenberg <lars.ellenberg@linbit.com>
parent 8dbcdf81
......@@ -588,6 +588,7 @@ static int atodb_prepare_unless_covered(struct drbd_conf *mdev,
}
/* bios[i] == NULL, the next not yet used slot */
/* GFP_KERNEL, we are not in the write-out path */
bio = bio_alloc(GFP_KERNEL, 1);
if (bio == NULL)
return -ENOMEM;
......@@ -661,6 +662,7 @@ void drbd_al_to_on_disk_bm(struct drbd_conf *mdev)
nr_elements = mdev->act_log->nr_elements;
/* GFP_KERNEL, we are not in anyones write-out path */
bios = kzalloc(sizeof(struct bio *) * nr_elements, GFP_KERNEL);
if (!bios)
goto submit_one_by_one;
......
......@@ -2998,6 +2998,7 @@ struct drbd_conf *drbd_new_device(unsigned int minor)
struct gendisk *disk;
struct request_queue *q;
/* GFP_KERNEL, we are outside of all write-out paths */
mdev = kzalloc(sizeof(struct drbd_conf), GFP_KERNEL);
if (!mdev)
return NULL;
......
......@@ -1299,7 +1299,10 @@ read_in_block(struct drbd_conf *mdev, u64 id, sector_t sector, int data_size) __
ERR_IF(data_size & 0x1ff) return NULL;
ERR_IF(data_size > DRBD_MAX_SEGMENT_SIZE) return NULL;
e = drbd_alloc_ee(mdev, id, sector, data_size, GFP_KERNEL);
/* GFP_NOIO, because we must not cause arbitrary write-out: in a DRBD
* "criss-cross" setup, that might cause write-out on some other DRBD,
* which in turn might block on the other node at this very place. */
e = drbd_alloc_ee(mdev, id, sector, data_size, GFP_NOIO);
if (!e)
return NULL;
bio = e->private_bio;
......@@ -1966,7 +1969,10 @@ static int receive_DataRequest(struct drbd_conf *mdev, struct p_header *h)
return TRUE;
}
e = drbd_alloc_ee(mdev, p->block_id, sector, size, GFP_KERNEL);
/* GFP_NOIO, because we must not cause arbitrary write-out: in a DRBD
* "criss-cross" setup, that might cause write-out on some other DRBD,
* which in turn might block on the other node at this very place. */
e = drbd_alloc_ee(mdev, p->block_id, sector, size, GFP_NOIO);
if (!e) {
put_ldev(mdev);
return FALSE;
......
......@@ -367,6 +367,8 @@ static int read_for_csum(struct drbd_conf *mdev, sector_t sector, int size)
if (FAULT_ACTIVE(mdev, DRBD_FAULT_AL_EE))
return 2;
/* GFP_TRY, because if there is no memory available right now, this may
* be rescheduled for later. It is "only" background resync, after all. */
e = drbd_alloc_ee(mdev, DRBD_MAGIC+0xbeef, sector, size, GFP_TRY);
if (!e) {
put_ldev(mdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment