[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a96e7af6-a807-1ca9-af50-4e0a7d771ac8@virtuozzo.com>
Date: Wed, 11 Dec 2019 11:50:52 +0300
From: Kirill Tkhai <ktkhai@...tuozzo.com>
To: Chaitanya Kulkarni <Chaitanya.Kulkarni@....com>,
"linux-block@...r.kernel.org" <linux-block@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-ext4@...r.kernel.org" <linux-ext4@...r.kernel.org>
Cc: "axboe@...nel.dk" <axboe@...nel.dk>,
"tytso@....edu" <tytso@....edu>,
"adilger.kernel@...ger.ca" <adilger.kernel@...ger.ca>,
"ming.lei@...hat.com" <ming.lei@...hat.com>,
"osandov@...com" <osandov@...com>,
"jthumshirn@...e.de" <jthumshirn@...e.de>,
"minwoo.im.dev@...il.com" <minwoo.im.dev@...il.com>,
Damien Le Moal <Damien.LeMoal@....com>,
"andrea.parri@...rulasolutions.com"
<andrea.parri@...rulasolutions.com>,
"hare@...e.com" <hare@...e.com>, "tj@...nel.org" <tj@...nel.org>,
Ajay Joshi <Ajay.Joshi@....com>,
"sagi@...mberg.me" <sagi@...mberg.me>,
"dsterba@...e.com" <dsterba@...e.com>,
"bvanassche@....org" <bvanassche@....org>,
"dhowells@...hat.com" <dhowells@...hat.com>,
"asml.silence@...il.com" <asml.silence@...il.com>
Subject: Re: [PATCH RFC 0/3] block,ext4: Introduce REQ_OP_ASSIGN_RANGE to
reflect extents allocation in block device internals
On 11.12.2019 10:42, Chaitanya Kulkarni wrote:
>> Here is a simple test I did:
>> https://gist.github.com/tkhai/5b788651cdb74c1dbff3500745878856
>>
>
> Somehow I'm not able to open this link, can you please share results
> in plain text on the email ?
#define _GNU_SOURCE
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
#define BLOCK_SIZE 4096
#define STEP (BLOCK_SIZE * 16)
#define SIZE (4ULL * 1024 * 1024 * 1024)
int main(int argc)
{
int fd, step, ret = 0;
unsigned long i;
void *buf;
if (posix_memalign(&buf, BLOCK_SIZE, SIZE)) {
perror("alloc");
exit(1);
}
fd = open("file2.img", O_RDWR|O_CREAT|O_DIRECT);
if (fd < 0) {
perror("open");
exit(1);
}
if (ftruncate(fd, SIZE)) {
perror("ftruncate");
exit(1);
}
ret = fallocate(fd, 0, 0, SIZE);
if (ret) {
perror("fallocate");
exit(1);
}
for (step = STEP - BLOCK_SIZE; step >= 0; step -= BLOCK_SIZE) {
printf("step=%u\n", step);
for (i = step; i < SIZE; i += STEP) {
errno = 0;
if (pwrite(fd, buf, BLOCK_SIZE, i) != BLOCK_SIZE) {
perror("pwrite");
exit(1);
}
}
if (fsync(fd)) {
perror("fsync");
exit(1);
}
}
return 0;
}
Powered by blists - more mailing lists