nilfs2: add update functions of virtual block address to dat
[safe/jmp/linux-2.6] / fs / nilfs2 / dat.c
index 1cfcc1a..1ff8e15 100644 (file)
@@ -211,6 +211,37 @@ void nilfs_dat_abort_end(struct inode *dat, struct nilfs_palloc_req *req)
        nilfs_dat_abort_entry(dat, req);
 }
 
+int nilfs_dat_prepare_update(struct inode *dat,
+                            struct nilfs_palloc_req *oldreq,
+                            struct nilfs_palloc_req *newreq)
+{
+       int ret;
+
+       ret = nilfs_dat_prepare_end(dat, oldreq);
+       if (!ret) {
+               ret = nilfs_dat_prepare_alloc(dat, newreq);
+               if (ret < 0)
+                       nilfs_dat_abort_end(dat, oldreq);
+       }
+       return ret;
+}
+
+void nilfs_dat_commit_update(struct inode *dat,
+                            struct nilfs_palloc_req *oldreq,
+                            struct nilfs_palloc_req *newreq, int dead)
+{
+       nilfs_dat_commit_end(dat, oldreq, dead);
+       nilfs_dat_commit_alloc(dat, newreq);
+}
+
+void nilfs_dat_abort_update(struct inode *dat,
+                           struct nilfs_palloc_req *oldreq,
+                           struct nilfs_palloc_req *newreq)
+{
+       nilfs_dat_abort_end(dat, oldreq);
+       nilfs_dat_abort_alloc(dat, newreq);
+}
+
 /**
  * nilfs_dat_mark_dirty -
  * @dat: DAT file inode