Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

selftests: ublk: support non-O_DIRECT backing files

A subsequent commit will add support for using a backing file to store
integrity data. Since integrity data is accessed in intervals of
metadata_size, which may be much smaller than a logical block on the
backing device, direct I/O cannot be used. Add an argument to
backing_file_tgt_init() to specify the number of files to open for
direct I/O. The remaining files will use buffered I/O. For now, continue
to request direct I/O for all the files.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Caleb Sander Mateos and committed by
Jens Axboe
a1805442 24f8a44b

+5 -5
+2 -2
tools/testing/selftests/ublk/common.c
··· 12 12 } 13 13 } 14 14 15 - int backing_file_tgt_init(struct ublk_dev *dev) 15 + int backing_file_tgt_init(struct ublk_dev *dev, unsigned int nr_direct) 16 16 { 17 17 int fd, i; 18 18 ··· 25 25 26 26 ublk_dbg(UBLK_DBG_DEV, "%s: file %d: %s\n", __func__, i, file); 27 27 28 - fd = open(file, O_RDWR | O_DIRECT); 28 + fd = open(file, O_RDWR | (i < nr_direct ? O_DIRECT : 0)); 29 29 if (fd < 0) { 30 30 ublk_err("%s: backing file %s can't be opened: %s\n", 31 31 __func__, file, strerror(errno));
+1 -1
tools/testing/selftests/ublk/file_backed.c
··· 163 163 return -EINVAL; 164 164 } 165 165 166 - ret = backing_file_tgt_init(dev); 166 + ret = backing_file_tgt_init(dev, 1); 167 167 if (ret) 168 168 return ret; 169 169
+1 -1
tools/testing/selftests/ublk/kublk.h
··· 462 462 extern const struct ublk_tgt_ops fault_inject_tgt_ops; 463 463 464 464 void backing_file_tgt_deinit(struct ublk_dev *dev); 465 - int backing_file_tgt_init(struct ublk_dev *dev); 465 + int backing_file_tgt_init(struct ublk_dev *dev, unsigned int nr_direct); 466 466 467 467 #endif
+1 -1
tools/testing/selftests/ublk/stripe.c
··· 315 315 316 316 chunk_shift = ilog2(chunk_size); 317 317 318 - ret = backing_file_tgt_init(dev); 318 + ret = backing_file_tgt_init(dev, dev->tgt.nr_backing_files); 319 319 if (ret) 320 320 return ret; 321 321