Lines 194-199
void SetUp()
Link Here
|
194 |
}, Eq(true)), |
194 |
}, Eq(true)), |
195 |
_) |
195 |
_) |
196 |
).WillRepeatedly(Invoke(ReturnErrno(0))); |
196 |
).WillRepeatedly(Invoke(ReturnErrno(0))); |
|
|
197 |
EXPECT_CALL(*m_mock, process( |
198 |
ResultOf([=](auto in) { |
199 |
return (in.header.opcode == FUSE_FALLOCATE && |
200 |
in.header.nodeid == ino && |
201 |
in.body.fallocate.mode == |
202 |
(FUSE_FALLOC_FL_KEEP_SIZE | |
203 |
FUSE_FALLOC_FL_PUNCH_HOLE)); |
204 |
|
205 |
}, Eq(true)), |
206 |
_) |
207 |
).WillRepeatedly(Invoke(ReturnImmediate([=](auto in, auto& out) { |
208 |
spacectl_range rqsr = { |
209 |
.r_offset = (off_t)in.body.fallocate.offset, |
210 |
.r_len = (off_t)in.body.fallocate.length |
211 |
}; |
212 |
ASSERT_EQ(0, fspacectl(m_backing_fd, SPACECTL_DEALLOC, &rqsr, |
213 |
0, &rqsr)) |
214 |
<< strerror(errno); |
215 |
out.header.len = sizeof(out.header); |
216 |
}))); |
197 |
|
217 |
|
198 |
m_test_fd = open(FULLPATH, O_RDWR ); |
218 |
m_test_fd = open(FULLPATH, O_RDWR ); |
199 |
EXPECT_LE(0, m_test_fd) << strerror(errno); |
219 |
EXPECT_LE(0, m_test_fd) << strerror(errno); |
Lines 222-227
void do_closeopen()
Link Here
|
222 |
ASSERT_LE(0, m_control_fd) << strerror(errno); |
242 |
ASSERT_LE(0, m_control_fd) << strerror(errno); |
223 |
} |
243 |
} |
224 |
|
244 |
|
|
|
245 |
void do_fspacectl(ssize_t size, off_t offs) |
246 |
{ |
247 |
struct spacectl_range rqsr = { |
248 |
.r_offset = offs, |
249 |
.r_len = size, |
250 |
}; |
251 |
struct spacectl_range rmsr; |
252 |
|
253 |
ASSERT_EQ(0, fspacectl(m_test_fd, SPACECTL_DEALLOC, &rqsr, 0, &rmsr)) |
254 |
<< strerror(errno); |
255 |
EXPECT_EQ(0, rmsr.r_len); |
256 |
EXPECT_EQ(offs + size, rmsr.r_offset); |
257 |
ASSERT_EQ(0, fspacectl(m_control_fd, SPACECTL_DEALLOC, &rqsr, 0, &rmsr)) |
258 |
<< strerror(errno); |
259 |
EXPECT_EQ(0, rmsr.r_len); |
260 |
EXPECT_EQ(offs + size, rmsr.r_offset); |
261 |
} |
262 |
|
225 |
void do_ftruncate(off_t offs) |
263 |
void do_ftruncate(off_t offs) |
226 |
{ |
264 |
{ |
227 |
ASSERT_EQ(0, ftruncate(m_test_fd, offs)) << strerror(errno); |
265 |
ASSERT_EQ(0, ftruncate(m_test_fd, offs)) << strerror(errno); |
Lines 506-511
TEST_P(Io, resize_a_valid_buffer_while_extending)
Link Here
|
506 |
close(m_test_fd); |
544 |
close(m_test_fd); |
507 |
} |
545 |
} |
508 |
|
546 |
|
|
|
547 |
/* Revealed with bfffs 4a0eef6c6011fa3c0ab898dbd647c1ea27986004 using fsx c3e726d6de39d4b2641cd8b49bbd19beef456604 |
548 |
* |
549 |
* fsx -f fsx.toml -N 1000 -P /tmp -S 2153242284826767701 /testpool/tmp/fsx.bin |
550 |
* |
551 |
* fsx.toml: |
552 |
* nomsyncafterwrite = true |
553 |
* [weights] |
554 |
* close_open = 0.1 |
555 |
* invalidate = 0.2 |
556 |
* truncate = 1 |
557 |
* fsync = 1 |
558 |
* fdatasync = 1 |
559 |
* punch_hole = 100 |
560 |
*/ |
561 |
TEST_P(IoCacheable, fsx_bfffs_fspacectl) |
562 |
{ |
563 |
do_mapwrite(0x80f1, 0x1ffb4); |
564 |
do_fspacectl(0x1f7, 0x27eae); |
565 |
do_mapread(0xb982, 0x16252); |
566 |
} |
567 |
|
509 |
INSTANTIATE_TEST_CASE_P(Io, Io, |
568 |
INSTANTIATE_TEST_CASE_P(Io, Io, |
510 |
Combine(Bool(), /* async read */ |
569 |
Combine(Bool(), /* async read */ |
511 |
Values(0x1000, 0x10000, 0x20000), /* m_maxwrite */ |
570 |
Values(0x1000, 0x10000, 0x20000), /* m_maxwrite */ |