Lines Matching refs:bsize

96 beos_read_phys_blocks(int fd, fs_off_t bnum, void *data, uint num_blocks, int bsize)
104 if (num_blocks * bsize < CHUNK)
105 ret = read_pos(fd, bnum * bsize, data, num_blocks * bsize);
107 for(sum=0; (sum + CHUNK) <= (num_blocks * bsize); sum += CHUNK) {
108 ret = read_pos(fd, (bnum * bsize) + sum, data, CHUNK);
115 if (ret == CHUNK && ((num_blocks * bsize) - sum) > 0) {
116 ret = read_pos(fd, (bnum * bsize) + sum, data,
117 (num_blocks * bsize) - sum);
119 if (ret == (num_blocks * bsize) - sum)
120 ret = num_blocks * bsize;
122 ret = num_blocks * bsize;
126 if (ret == num_blocks * bsize)
133 beos_write_phys_blocks(int fd, fs_off_t bnum, void *data, uint num_blocks, int bsize)
141 if (num_blocks * bsize < CHUNK)
142 ret = write_pos(fd, bnum * bsize, data, num_blocks * bsize);
144 for(sum=0; (sum + CHUNK) <= (num_blocks * bsize); sum += CHUNK) {
145 ret = write_pos(fd, (bnum * bsize) + sum, data, CHUNK);
152 if (ret == CHUNK && ((num_blocks * bsize) - sum) > 0) {
153 ret = write_pos(fd, (bnum * bsize) + sum, data,
154 (num_blocks * bsize) - sum);
156 if (ret == (num_blocks * bsize) - sum)
157 ret = num_blocks * bsize;
159 ret = num_blocks * bsize;
164 if (ret == num_blocks * bsize)
895 ret = beos_write_phys_blocks(ce->dev, ce->block_num, data, 1, ce->bsize);
919 int i, j, k, ret = 0, bsize, iocnt, do_again = 0;
938 bsize = ents[i]->bsize;
963 iov[iocnt].iov_len = bsize;
969 ret = writev_pos(ents[i]->dev, start_bnum * (fs_off_t)bsize,
971 if (ret != iocnt*bsize) {
975 "bsize %d, ret %d\n", iocnt, start_bnum, bsize, ret);
982 strerror(errno), start_bnum, iocnt, ret, iocnt*bsize);
1275 ce->clone = (void *)malloc(ce->bsize);
1277 beos_panic("*** can't clone bnum %Ld (bsize %d)\n",
1278 ce->block_num, ce->bsize);
1281 memcpy(ce->clone, ce->data, ce->bsize);
1599 new_cache_ent(int bsize)
1609 ce->data = malloc(bsize);
1625 get_ents(cache_ent **ents, int num_needed, int max, int *num_gotten, int bsize)
1635 ents[cur] = new_cache_ent(bsize);
1693 read_into_ents(int dev, fs_off_t bnum, cache_ent **ents, int num, int bsize)
1702 iov[i].iov_len = bsize;
1706 printf("readv @ %Ld for %d blocks (at %Ld, block_size = %d)\n", bnum, num, bnum*bsize, bsize);
1707 ret = readv_pos(dev, bnum*bsize, iov, num);
1711 if (ret != num*bsize) {
1713 num*bsize, ret);
1751 cache_block_io(int dev, fs_off_t bnum, void *data, fs_off_t num_blocks, int bsize,
1759 printf("cbio: bnum = %Ld, num_blocks = %Ld, bsize = %d, op = %s\n", bnum, num_blocks,
1760 bsize, op_to_str(op));
1763 if (bsize == 0)
1796 if (num_blocks * bsize >= 64 * 1024) {
1806 if (beos_read_phys_blocks(dev, bnum, data, num_blocks, bsize) != 0) {
1816 for(tmp=bnum; tmp < bnum+num_blocks; tmp++, ptr+=bsize) {
1833 memcpy(ptr, ce->data, bsize);
1843 for(tmp=bnum; tmp < bnum+num_blocks; tmp++, ptr+=bsize) {
1861 memcpy(ce->data, ptr, bsize);
1867 if (beos_write_phys_blocks(dev, bnum, data, num_blocks, bsize) != 0) {
1893 if (bsize != ce->bsize) {
1894 beos_panic("*** requested bsize %d but ce->bsize %d ce @ 0x%x\n",
1895 bsize, ce->bsize, ce);
1908 memcpy(data, ce->data, bsize);
1917 memcpy(ce->data, data, bsize);
1921 memset(ce->data, 0, bsize);
1923 memset(data, 0, bsize);
1945 data = (void *)((char *)data + bsize);
1979 (cur_nblocks * bsize) < read_ahead_size) {
1982 num_needed < (read_ahead_size / bsize);
1996 get_ents(ents, num_needed, NUM_FLUSH_BLOCKS, &real_nblocks, bsize);
2093 if (ents[cur]->bsize != bsize) {
2106 ents[cur]->data = (void *)malloc(bsize);
2107 ents[cur]->bsize = bsize;
2111 printf("cache: no memory for block (bsize %d)!\n",
2112 bsize);
2177 err = read_into_ents(dev, bnum, ents, num_needed, bsize);
2186 bsize, data, ents[0]);
2287 ce->bsize = bsize;
2296 memcpy(data, ce->data, bsize);
2299 memcpy(ce->data, data, bsize);
2301 memset(ce->data, 0, bsize);
2303 memset(data, 0, bsize);
2324 data = (void *)((char *)data + bsize);
2343 beos_get_block(int dev, fs_off_t bnum, int bsize)
2347 if (cache_block_io(dev, bnum, NULL, 1, bsize, CACHE_READ|CACHE_LOCKED|CACHE_READ_AHEAD_OK,
2355 beos_get_empty_block(int dev, fs_off_t bnum, int bsize)
2359 if (cache_block_io(dev, bnum, NULL, 1, bsize, CACHE_NOOP|CACHE_LOCKED,
2367 beos_cached_read(int dev, fs_off_t bnum, void *data, fs_off_t num_blocks, int bsize)
2369 return cache_block_io(dev, bnum, data, num_blocks, bsize,
2375 beos_cached_write(int dev, fs_off_t bnum, const void *data, fs_off_t num_blocks,int bsize)
2377 return cache_block_io(dev, bnum, (void *)data, num_blocks, bsize,
2383 fs_off_t num_blocks, int bsize)
2385 return cache_block_io(dev, bnum, (void *)data, num_blocks, bsize,