Skip to contentSkip to conversation

libf2fs: move the finalize_device() into the io lib.

PATCH In review JP Abgrall 2 participants 2 messages Jun 13, 2014 – Jun 14, 2014 Library code

lore
Share & tools
lore

JP Abgrall

author
#0 lore raw

PATCH 1/1 libf2fs: move the finalize_device() into the io lib.

This is required so that libf2fs.c can be used against any kind of device (E.g. an in-memory sparse file) just by linking against something that provides the libf2fs_io.c functions.

libf2fs is currently libf2fs.c + libf2fs_io.c

---
 lib/libf2fs.c    | 12 ------------
 lib/libf2fs_io.c | 13 +++++++++++++
 2 files changed, 13 insertions(+), 12 deletions(-)
lib/libf2fs.c +0 -12
index 8d6c670..6168c5c 100644
@@ -493,15 +493,3 @@ int f2fs_get_device_info(struct f2fs_configuration *c)
 	return 0;
 }
 
-void f2fs_finalize_device(struct f2fs_configuration *c)
-{
-	/*
-	 * We should call fsync() to flush out all the dirty pages
-	 * in the block device page cache.
-	 */
-	if (fsync(c->fd) < 0)
-		MSG(0, "\tError: Could not conduct fsync!!!\n");
-
-	if (close(c->fd) < 0)
-		MSG(0, "\tError: Failed to close device file!!!\n");
-}
lib/libf2fs_io.c +13 -0
index 508ccce..5d9b68d 100644
@@ -67,3 +67,16 @@ int dev_read_blocks(void *buf, __u64 addr, __u32 nr_blks)
 {
 	return dev_read(buf, addr * F2FS_BLKSIZE, nr_blks * F2FS_BLKSIZE);
 }
+
+void f2fs_finalize_device(struct f2fs_configuration *c)
+{
+	/*
+	 * We should call fsync() to flush out all the dirty pages
+	 * in the block device page cache.
+	 */
+	if (fsync(c->fd) < 0)
+		MSG(0, "\tError: Could not conduct fsync!!!\n");
+
+	if (close(c->fd) < 0)
+		MSG(0, "\tError: Failed to close device file!!!\n");
+}
Signature · 9 lines
2.0.0.526.g5318336


------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
#1 lore raw
Quoted 5 lines · JP Abgrall

This is required so that libf2fs.c can be used against any kind of device (E.g. an in-memory sparse file) just by linking against something that provides the libf2fs_io.c functions.

libf2fs is currently libf2fs.c + libf2fs_io.c

Ok, merged.
Thanks,

Quoted 62 lines
---
 lib/libf2fs.c    | 12 ------------
 lib/libf2fs_io.c | 13 +++++++++++++
 2 files changed, 13 insertions(+), 12 deletions(-)
lib/libf2fs.c +0 -12
index 8d6c670..6168c5c 100644
@@ -493,15 +493,3 @@ int f2fs_get_device_info(struct f2fs_configuration *c)
 	return 0;
 }
 
-void f2fs_finalize_device(struct f2fs_configuration *c)
-{
-	/*
-	 * We should call fsync() to flush out all the dirty pages
-	 * in the block device page cache.
-	 */
-	if (fsync(c->fd) < 0)
-		MSG(0, "\tError: Could not conduct fsync!!!\n");
-
-	if (close(c->fd) < 0)
-		MSG(0, "\tError: Failed to close device file!!!\n");
-}
lib/libf2fs_io.c +13 -0
index 508ccce..5d9b68d 100644
@@ -67,3 +67,16 @@ int dev_read_blocks(void *buf, __u64 addr, __u32 nr_blks)
 {
 	return dev_read(buf, addr * F2FS_BLKSIZE, nr_blks * F2FS_BLKSIZE);
 }
+
+void f2fs_finalize_device(struct f2fs_configuration *c)
+{
+	/*
+	 * We should call fsync() to flush out all the dirty pages
+	 * in the block device page cache.
+	 */
+	if (fsync(c->fd) < 0)
+		MSG(0, "\tError: Could not conduct fsync!!!\n");
+
+	if (close(c->fd) < 0)
+		MSG(0, "\tError: Failed to close device file!!!\n");
+}
Signature · 13 lines
2.0.0.526.g5318336


------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Signature · 8 lines
Jaegeuk Kim

------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems