Hi

Digging through the file-daemon source-code I think that it can be a bit
more nice to the host and even allow the client OS to benefit a bit from
the following patch. The patch is in "no way" finished, since it'll most
likely break builds on all but Linux/FreeBSD but I'm not a very skilled
C-programmer, so I would hope someone with a bit more insight on this
would pick it up and finish it.

POSIX_FADV_SEQUENTIAL => Allows the OS do do a larger read-ahhead.
POSIX_FADV_NOREUSE => Allows the OS to drop pages from the page-cache
after read, since they won't be used again.

diff --git a/bacula/src/filed/backup.c b/bacula/src/filed/backup.c
index 38d889b..65afd99 100644
--- a/bacula/src/filed/backup.c
+++ b/bacula/src/filed/backup.c
@@ -772,6 +772,7 @@ static int send_data(JCR *jcr, int stream, FF_PKT
*ff_pkt, DIGEST *digest,
    uint32_t cipher_input_len;
    uint32_t cipher_block_size;
    uint32_t encrypted_len;
+   BFILE *bfd = &ff_pkt->bfd;
 #ifdef FD_NO_SEND_TEST
    return 1;
 #endif
@@ -882,6 +883,7 @@ static int send_data(JCR *jcr, int stream, FF_PKT
*ff_pkt, DIGEST *digest,
       rsize = (rsize/512) * 512;
 #endif

+    posix_fadvise(bfd->fid,0,0,POSIX_FADV_SEQUENTIAL & POSIX_FADV_NOREUSE);
    /*
     * Read the file data
     */
diff --git a/bacula/src/filed/filed.h b/bacula/src/filed/filed.h
index 54905cb..c5d0423 100644
--- a/bacula/src/filed/filed.h
+++ b/bacula/src/filed/filed.h
@@ -78,4 +78,8 @@ typedef enum {
 #define uLongf uint32_t
 #endif

+#define _XOPEN_SOURCE 600
+#include <fcntl.h>
+
+
 extern CLIENT *me;                    /* "Global" Client resource */

Thanks.

-- 
Jesper

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Bacula-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bacula-devel

Reply via email to