Lines Matching defs:dat

17 #include "dat.h"
35 static inline struct nilfs_dat_info *NILFS_DAT_I(struct inode *dat)
37 return (struct nilfs_dat_info *)NILFS_MDT(dat);
40 static int nilfs_dat_prepare_entry(struct inode *dat,
45 ret = nilfs_palloc_get_entry_block(dat, req->pr_entry_nr,
48 nilfs_err(dat->i_sb,
60 static void nilfs_dat_commit_entry(struct inode *dat,
64 nilfs_mdt_mark_dirty(dat);
68 static void nilfs_dat_abort_entry(struct inode *dat,
74 int nilfs_dat_prepare_alloc(struct inode *dat, struct nilfs_palloc_req *req)
78 ret = nilfs_palloc_prepare_alloc_entry(dat, req);
82 ret = nilfs_dat_prepare_entry(dat, req, 1);
84 nilfs_palloc_abort_alloc_entry(dat, req);
89 void nilfs_dat_commit_alloc(struct inode *dat, struct nilfs_palloc_req *req)
95 entry = nilfs_palloc_block_get_entry(dat, req->pr_entry_nr,
102 nilfs_palloc_commit_alloc_entry(dat, req);
103 nilfs_dat_commit_entry(dat, req);
106 void nilfs_dat_abort_alloc(struct inode *dat, struct nilfs_palloc_req *req)
108 nilfs_dat_abort_entry(dat, req);
109 nilfs_palloc_abort_alloc_entry(dat, req);
112 static void nilfs_dat_commit_free(struct inode *dat,
119 entry = nilfs_palloc_block_get_entry(dat, req->pr_entry_nr,
126 nilfs_dat_commit_entry(dat, req);
129 nilfs_error(dat->i_sb,
134 nilfs_palloc_commit_free_entry(dat, req);
137 int nilfs_dat_prepare_start(struct inode *dat, struct nilfs_palloc_req *req)
139 return nilfs_dat_prepare_entry(dat, req, 0);
142 void nilfs_dat_commit_start(struct inode *dat, struct nilfs_palloc_req *req,
149 entry = nilfs_palloc_block_get_entry(dat, req->pr_entry_nr,
151 entry->de_start = cpu_to_le64(nilfs_mdt_cno(dat));
155 nilfs_dat_commit_entry(dat, req);
158 int nilfs_dat_prepare_end(struct inode *dat, struct nilfs_palloc_req *req)
166 ret = nilfs_dat_prepare_entry(dat, req, 0);
171 entry = nilfs_palloc_block_get_entry(dat, req->pr_entry_nr,
178 ret = nilfs_palloc_prepare_free_entry(dat, req);
180 nilfs_dat_abort_entry(dat, req);
184 if (unlikely(start > nilfs_mdt_cno(dat))) {
185 nilfs_err(dat->i_sb,
189 (unsigned long long)nilfs_mdt_cno(dat));
190 nilfs_dat_abort_entry(dat, req);
197 void nilfs_dat_commit_end(struct inode *dat, struct nilfs_palloc_req *req,
206 entry = nilfs_palloc_block_get_entry(dat, req->pr_entry_nr,
210 end = nilfs_mdt_cno(dat);
218 nilfs_dat_commit_free(dat, req);
220 nilfs_dat_commit_entry(dat, req);
223 void nilfs_dat_abort_end(struct inode *dat, struct nilfs_palloc_req *req)
231 entry = nilfs_palloc_block_get_entry(dat, req->pr_entry_nr,
237 if (start == nilfs_mdt_cno(dat) && blocknr == 0)
238 nilfs_palloc_abort_free_entry(dat, req);
239 nilfs_dat_abort_entry(dat, req);
242 int nilfs_dat_prepare_update(struct inode *dat,
248 ret = nilfs_dat_prepare_end(dat, oldreq);
250 ret = nilfs_dat_prepare_alloc(dat, newreq);
252 nilfs_dat_abort_end(dat, oldreq);
257 void nilfs_dat_commit_update(struct inode *dat,
261 nilfs_dat_commit_end(dat, oldreq, dead);
262 nilfs_dat_commit_alloc(dat, newreq);
265 void nilfs_dat_abort_update(struct inode *dat,
269 nilfs_dat_abort_end(dat, oldreq);
270 nilfs_dat_abort_alloc(dat, newreq);
275 * @dat: DAT file inode
287 int nilfs_dat_mark_dirty(struct inode *dat, __u64 vblocknr)
293 ret = nilfs_dat_prepare_entry(dat, &req, 0);
295 nilfs_dat_commit_entry(dat, &req);
301 * @dat: DAT file inode
317 int nilfs_dat_freev(struct inode *dat, __u64 *vblocknrs, size_t nitems)
319 return nilfs_palloc_freev(dat, vblocknrs, nitems);
324 * @dat: DAT file inode
338 int nilfs_dat_move(struct inode *dat, __u64 vblocknr, sector_t blocknr)
345 ret = nilfs_palloc_get_entry_block(dat, vblocknr, 0, &entry_bh);
358 ret = nilfs_mdt_freeze_buffer(dat, entry_bh);
366 entry = nilfs_palloc_block_get_entry(dat, vblocknr, entry_bh, kaddr);
368 nilfs_crit(dat->i_sb,
382 nilfs_mdt_mark_dirty(dat);
391 * @dat: DAT file inode
408 int nilfs_dat_translate(struct inode *dat, __u64 vblocknr, sector_t *blocknrp)
416 ret = nilfs_palloc_get_entry_block(dat, vblocknr, 0, &entry_bh);
421 bh = nilfs_mdt_get_frozen_buffer(dat, entry_bh);
430 entry = nilfs_palloc_block_get_entry(dat, vblocknr, entry_bh, kaddr);
444 ssize_t nilfs_dat_get_vinfo(struct inode *dat, void *buf, unsigned int visz,
452 unsigned long entries_per_block = NILFS_MDT(dat)->mi_entries_per_block;
456 ret = nilfs_palloc_get_entry_block(dat, vinfo->vi_vblocknr,
471 dat, vinfo->vi_vblocknr, entry_bh, kaddr);
484 * nilfs_dat_read - read or get dat inode
486 * @entry_size: size of a dat entry
487 * @raw_inode: on-disk dat inode
494 struct inode *dat;
508 dat = nilfs_iget_locked(sb, NULL, NILFS_DAT_INO);
509 if (unlikely(!dat))
511 if (!(dat->i_state & I_NEW))
514 err = nilfs_mdt_init(dat, NILFS_MDT_GFP, sizeof(*di));
518 err = nilfs_palloc_init_blockgroup(dat, entry_size);
522 di = NILFS_DAT_I(dat);
524 nilfs_palloc_setup_cache(dat, &di->palloc_cache);
525 err = nilfs_mdt_setup_shadow_map(dat, &di->shadow);
529 err = nilfs_read_inode_common(dat, raw_inode);
533 unlock_new_inode(dat);
535 *inodep = dat;
538 iget_failed(dat);