[f2fs] Use fbl::MakeRefCounted when creating ref-counted objects
(Comment: https://fuchsia-review.googlesource.com/c/third_party/f2fs/+/536501/2/vnode.cc#74)
Test: fx test fs-tests
Failed tests: RwFullDiskTest.PartialWriteSucceedsForFullDisk/F2fs
Change-Id: I9d384cd348e22b9c0af89ebb0956901d5d8ca927
Reviewed-on: https://fuchsia-review.googlesource.com/c/third_party/f2fs/+/536743
Reviewed-by: Brett Wilson <brettw@google.com>
diff --git a/vnode.cc b/vnode.cc
index 75f12a1..5761d16 100644
--- a/vnode.cc
+++ b/vnode.cc
@@ -41,9 +41,9 @@
CheckNidRange(&fs->GetSbInfo(), ino);
if (S_ISDIR(mode)) {
- *out = fbl::AdoptRef(new Dir(fs, ino));
+ *out = fbl::MakeRefCounted<Dir>(fs, ino);
} else {
- *out = fbl::AdoptRef(new File(fs, ino));
+ *out = fbl::MakeRefCounted<File>(fs, ino);
}
VnodeF2fs *vnode = out->get();
@@ -71,7 +71,7 @@
Node *rn;
if (ino == NodeIno(&fs->GetSbInfo()) || ino == MetaIno(&fs->GetSbInfo())) {
- *out = fbl::AdoptRef(new VnodeF2fs(fs, ino));
+ *out = fbl::MakeRefCounted<VnodeF2fs>(fs, ino);
return;
}
@@ -87,9 +87,9 @@
// [sukka] need to check result?
if (S_ISDIR(ri->i_mode)) {
- *out = fbl::AdoptRef(new Dir(fs, ino));
+ *out = fbl::MakeRefCounted<Dir>(fs, ino);
} else {
- *out = fbl::AdoptRef(new File(fs, ino));
+ *out = fbl::MakeRefCounted<File>(fs, ino);
}
memcpy(&(*out)->inode_, ri, sizeof(Inode));