Lines Matching refs:bsize

83 read_phys_blocks(int fd, fs_off_t bnum, void *data, uint num_blocks, int bsize)
91 if (num_blocks * bsize < CHUNK)
92 ret = read_pos(fd, bnum * bsize, data, num_blocks * bsize);
94 for(sum=0; (sum + CHUNK) <= (num_blocks * bsize); sum += CHUNK) {
95 ret = read_pos(fd, (bnum * bsize) + sum, data, CHUNK);
102 if (ret == CHUNK && ((num_blocks * bsize) - sum) > 0) {
103 ret = read_pos(fd, (bnum * bsize) + sum, data,
104 (num_blocks * bsize) - sum);
106 if (ret == (num_blocks * bsize) - sum)
107 ret = num_blocks * bsize;
109 ret = num_blocks * bsize;
113 if (ret == num_blocks * bsize)
120 write_phys_blocks(int fd, fs_off_t bnum, void *data, uint num_blocks, int bsize)
128 if (num_blocks * bsize < CHUNK)
129 ret = write_pos(fd, bnum * bsize, data, num_blocks * bsize);
131 for(sum=0; (sum + CHUNK) <= (num_blocks * bsize); sum += CHUNK) {
132 ret = write_pos(fd, (bnum * bsize) + sum, data, CHUNK);
139 if (ret == CHUNK && ((num_blocks * bsize) - sum) > 0) {
140 ret = write_pos(fd, (bnum * bsize) + sum, data,
141 (num_blocks * bsize) - sum);
143 if (ret == (num_blocks * bsize) - sum)
144 ret = num_blocks * bsize;
146 ret = num_blocks * bsize;
151 if (ret == num_blocks * bsize)
882 ret = write_phys_blocks(ce->dev, ce->block_num, data, 1, ce->bsize);
906 int i, j, k, ret = 0, bsize, iocnt, do_again = 0;
925 bsize = ents[i]->bsize;
950 iov[iocnt].iov_len = bsize;
956 ret = writev_pos(ents[i]->dev, start_bnum * (fs_off_t)bsize,
958 if (ret != iocnt*bsize) {
962 "bsize %d, ret %d\n", iocnt, start_bnum, bsize, ret);
969 strerror(errno), start_bnum, iocnt, ret, iocnt*bsize);
1264 ce->clone = (void *)malloc(ce->bsize);
1266 panic("*** can't clone bnum %Ld (bsize %d)\n",
1267 ce->block_num, ce->bsize);
1270 memcpy(ce->clone, ce->data, ce->bsize);
1590 new_cache_ent(int bsize)
1600 ce->data = malloc(bsize);
1616 get_ents(cache_ent **ents, int num_needed, int max, int *num_gotten, int bsize)
1626 ents[cur] = new_cache_ent(bsize);
1684 read_into_ents(int dev, fs_off_t bnum, cache_ent **ents, int num, int bsize)
1693 iov[i].iov_len = bsize;
1697 printf("readv @ %Ld for %d blocks (at %Ld, block_size = %d)\n", bnum, num, bnum*bsize, bsize);
1698 ret = readv_pos(dev, bnum*bsize, iov, num);
1702 if (ret != num*bsize) {
1704 num*bsize, ret);
1742 cache_block_io(int dev, fs_off_t bnum, void *data, fs_off_t num_blocks, int bsize,
1750 printf("cbio: bnum = %Ld, num_blocks = %Ld, bsize = %d, op = %s\n", bnum, num_blocks,
1751 bsize, op_to_str(op));
1754 if (bsize == 0)
1789 if (num_blocks * bsize >= 64 * 1024) {
1798 if (read_phys_blocks(dev, bnum, data, num_blocks, bsize) != 0) {
1808 for(tmp=bnum; tmp < bnum+num_blocks; tmp++, ptr+=bsize) {
1825 memcpy(ptr, ce->data, bsize);
1835 for(tmp=bnum; tmp < bnum+num_blocks; tmp++, ptr+=bsize) {
1853 memcpy(ce->data, ptr, bsize);
1859 if (write_phys_blocks(dev, bnum, data, num_blocks, bsize) != 0) {
1885 if (bsize != ce->bsize) {
1886 panic("*** requested bsize %d but ce->bsize %d ce @ 0x%x\n",
1887 bsize, ce->bsize, ce);
1900 memcpy(data, ce->data, bsize);
1909 memcpy(ce->data, data, bsize);
1913 memset(ce->data, 0, bsize);
1915 memset(data, 0, bsize);
1937 data = (void *)((char *)data + bsize);
1971 (cur_nblocks * bsize) < read_ahead_size) {
1974 num_needed < (read_ahead_size / bsize);
1988 get_ents(ents, num_needed, NUM_FLUSH_BLOCKS, &real_nblocks, bsize);
2085 if (ents[cur]->bsize != bsize) {
2098 ents[cur]->data = (void *)malloc(bsize);
2099 ents[cur]->bsize = bsize;
2103 printf("cache: no memory for block (bsize %d)!\n",
2104 bsize);
2169 err = read_into_ents(dev, bnum, ents, num_needed, bsize);
2178 bsize, data, ents[0]);
2279 ce->bsize = bsize;
2288 memcpy(data, ce->data, bsize);
2291 memcpy(ce->data, data, bsize);
2293 memset(ce->data, 0, bsize);
2295 memset(data, 0, bsize);
2316 data = (void *)((char *)data + bsize);
2335 get_block(int dev, fs_off_t bnum, int bsize)
2339 if (cache_block_io(dev, bnum, NULL, 1, bsize, CACHE_READ|CACHE_LOCKED|CACHE_READ_AHEAD_OK,
2347 get_empty_block(int dev, fs_off_t bnum, int bsize)
2351 if (cache_block_io(dev, bnum, NULL, 1, bsize, CACHE_NOOP|CACHE_LOCKED,
2359 cached_read(int dev, fs_off_t bnum, void *data, fs_off_t num_blocks, int bsize)
2361 return cache_block_io(dev, bnum, data, num_blocks, bsize,
2367 cached_write(int dev, fs_off_t bnum, const void *data, fs_off_t num_blocks,int bsize)
2369 return cache_block_io(dev, bnum, (void *)data, num_blocks, bsize,
2375 fs_off_t num_blocks, int bsize)
2377 return cache_block_io(dev, bnum, (void *)data, num_blocks, bsize,