Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/2aef095f27e55600f6cbd...
...commit
http://git.netsurf-browser.org/netsurf.git/commit/2aef095f27e55600f6cbdf6...
...tree
http://git.netsurf-browser.org/netsurf.git/tree/2aef095f27e55600f6cbdf6f3...
The branch, master has been updated
via 2aef095f27e55600f6cbdf6f3d4c4f1fe584f07b (commit)
via 05538c0264db8ba117248f481e769f62969dc82b (commit)
from c6a6c8e7faa9165d5337e61c6bd331071367cec0 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=2aef095f27e55600f6c...
commit 2aef095f27e55600f6cbdf6f3d4c4f1fe584f07b
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
Ensure bandwidth minimum check is only performed when enough data has
been written.
diff --git a/content/llcache.c b/content/llcache.c
index 2267f8f..9628fd3 100644
--- a/content/llcache.c
+++ b/content/llcache.c
@@ -2427,17 +2427,26 @@ write_backing_store(struct llcache_object *object,
* If the overall write bandwidth has fallen below a useful level for
* the backing store to be effective disable it.
*
+ * It is important to ensure a useful amount of data has been written
+ * before calculating bandwidths otherwise tiny files taking a
+ * disproportionately long time to write might trigger this erroneously.
+ *
* \param p The context pointer passed to the callback.
*/
static void llcache_persist_slowcheck(void *p)
{
- unsigned long total_bandwidth; /* total bandwidth */
- total_bandwidth = (llcache->total_written * 1000) / llcache->total_elapsed;
+ uint64_t total_bandwidth; /* total bandwidth */
+
+ if (llcache->total_written > (2 * llcache->minimum_bandwidth)) {
- if (total_bandwidth < llcache->minimum_bandwidth) {
- LOG(("Cannot write minimum bandwidth"));
- warn_user("LowDiscWriteBandwidth", 0);
- guit->llcache->finalise();
+ total_bandwidth = (llcache->total_written * 1000) / llcache->total_elapsed;
+
+ if (total_bandwidth < llcache->minimum_bandwidth) {
+ LOG(("Current bandwidth %llu less than minimum %llu",
+ total_bandwidth, llcache->minimum_bandwidth));
+ warn_user("LowDiscWriteBandwidth", 0);
+ guit->llcache->finalise();
+ }
}
}
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=05538c0264db8ba1172...
commit 05538c0264db8ba117248f481e769f62969dc82b
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
Ensure small block cache files allocate their entire extent at open.
It seems many filesystems are greatly more efficient if the block file
is allocated its entire extent once rather than trying to
continuously grown the file later.
The size of the block files is known at their creation time so this
change ensures they are grown to the full possible extent hence removing
future inefficient writes.
diff --git a/content/fs_backing_store.c b/content/fs_backing_store.c
index d23a9d1..2a5b3ea 100644
--- a/content/fs_backing_store.c
+++ b/content/fs_backing_store.c
@@ -31,8 +31,6 @@
* lifetime is typically very short, though this may be obsoleted
* by a small object storage stratagy.
*
- * \todo make backing store have a more efficient small object storage.
- *
*/
#include <unistd.h>
@@ -1591,9 +1589,14 @@ static nserror store_write_block(struct store_state *state,
if (state->blocks[elem_idx][bf].fd == -1) {
state->blocks[elem_idx][bf].fd = store_open(state, bf,
elem_idx + ENTRY_ELEM_COUNT, O_CREAT | O_RDWR);
- }
- if (state->blocks[elem_idx][bf].fd == -1) {
- return NSERROR_SAVE_FAILED;
+ if (state->blocks[elem_idx][bf].fd == -1) {
+ LOG(("Open failed errno %d", errno));
+ return NSERROR_SAVE_FAILED;
+ }
+
+ /* ensure block file is correct length at open */
+ ftruncate(state->blocks[elem_idx][bf].fd,
+ 1U << (log2_block_size[elem_idx] + BLOCK_ENTRY_COUNT));
}
offst = bi << log2_block_size[elem_idx];
@@ -1745,11 +1748,16 @@ static nserror store_read_block(struct store_state *state,
/* ensure the block file fd is good */
if (state->blocks[elem_idx][bf].fd == -1) {
- state->blocks[elem_idx][bf].fd = store_open(state, bf, elem_idx + ENTRY_ELEM_COUNT,
O_CREAT | O_RDWR);
- }
- if (state->blocks[elem_idx][bf].fd == -1) {
- LOG(("Open failed errno %d", errno));
- return NSERROR_SAVE_FAILED;
+ state->blocks[elem_idx][bf].fd = store_open(state, bf,
+ elem_idx + ENTRY_ELEM_COUNT, O_CREAT | O_RDWR);
+ if (state->blocks[elem_idx][bf].fd == -1) {
+ LOG(("Open failed errno %d", errno));
+ return NSERROR_SAVE_FAILED;
+ }
+
+ /* ensure block file is correct length at open */
+ ftruncate(state->blocks[elem_idx][bf].fd,
+ 1U << (log2_block_size[elem_idx] + BLOCK_ENTRY_COUNT));
}
offst = bi << log2_block_size[elem_idx];
-----------------------------------------------------------------------
Summary of changes:
content/fs_backing_store.c | 28 ++++++++++++++++++----------
content/llcache.c | 21 +++++++++++++++------
2 files changed, 33 insertions(+), 16 deletions(-)
diff --git a/content/fs_backing_store.c b/content/fs_backing_store.c
index d23a9d1..2a5b3ea 100644
--- a/content/fs_backing_store.c
+++ b/content/fs_backing_store.c
@@ -31,8 +31,6 @@
* lifetime is typically very short, though this may be obsoleted
* by a small object storage stratagy.
*
- * \todo make backing store have a more efficient small object storage.
- *
*/
#include <unistd.h>
@@ -1591,9 +1589,14 @@ static nserror store_write_block(struct store_state *state,
if (state->blocks[elem_idx][bf].fd == -1) {
state->blocks[elem_idx][bf].fd = store_open(state, bf,
elem_idx + ENTRY_ELEM_COUNT, O_CREAT | O_RDWR);
- }
- if (state->blocks[elem_idx][bf].fd == -1) {
- return NSERROR_SAVE_FAILED;
+ if (state->blocks[elem_idx][bf].fd == -1) {
+ LOG(("Open failed errno %d", errno));
+ return NSERROR_SAVE_FAILED;
+ }
+
+ /* ensure block file is correct length at open */
+ ftruncate(state->blocks[elem_idx][bf].fd,
+ 1U << (log2_block_size[elem_idx] + BLOCK_ENTRY_COUNT));
}
offst = bi << log2_block_size[elem_idx];
@@ -1745,11 +1748,16 @@ static nserror store_read_block(struct store_state *state,
/* ensure the block file fd is good */
if (state->blocks[elem_idx][bf].fd == -1) {
- state->blocks[elem_idx][bf].fd = store_open(state, bf, elem_idx + ENTRY_ELEM_COUNT,
O_CREAT | O_RDWR);
- }
- if (state->blocks[elem_idx][bf].fd == -1) {
- LOG(("Open failed errno %d", errno));
- return NSERROR_SAVE_FAILED;
+ state->blocks[elem_idx][bf].fd = store_open(state, bf,
+ elem_idx + ENTRY_ELEM_COUNT, O_CREAT | O_RDWR);
+ if (state->blocks[elem_idx][bf].fd == -1) {
+ LOG(("Open failed errno %d", errno));
+ return NSERROR_SAVE_FAILED;
+ }
+
+ /* ensure block file is correct length at open */
+ ftruncate(state->blocks[elem_idx][bf].fd,
+ 1U << (log2_block_size[elem_idx] + BLOCK_ENTRY_COUNT));
}
offst = bi << log2_block_size[elem_idx];
diff --git a/content/llcache.c b/content/llcache.c
index 2267f8f..9628fd3 100644
--- a/content/llcache.c
+++ b/content/llcache.c
@@ -2427,17 +2427,26 @@ write_backing_store(struct llcache_object *object,
* If the overall write bandwidth has fallen below a useful level for
* the backing store to be effective disable it.
*
+ * It is important to ensure a useful amount of data has been written
+ * before calculating bandwidths otherwise tiny files taking a
+ * disproportionately long time to write might trigger this erroneously.
+ *
* \param p The context pointer passed to the callback.
*/
static void llcache_persist_slowcheck(void *p)
{
- unsigned long total_bandwidth; /* total bandwidth */
- total_bandwidth = (llcache->total_written * 1000) / llcache->total_elapsed;
+ uint64_t total_bandwidth; /* total bandwidth */
+
+ if (llcache->total_written > (2 * llcache->minimum_bandwidth)) {
- if (total_bandwidth < llcache->minimum_bandwidth) {
- LOG(("Cannot write minimum bandwidth"));
- warn_user("LowDiscWriteBandwidth", 0);
- guit->llcache->finalise();
+ total_bandwidth = (llcache->total_written * 1000) / llcache->total_elapsed;
+
+ if (total_bandwidth < llcache->minimum_bandwidth) {
+ LOG(("Current bandwidth %llu less than minimum %llu",
+ total_bandwidth, llcache->minimum_bandwidth));
+ warn_user("LowDiscWriteBandwidth", 0);
+ guit->llcache->finalise();
+ }
}
}
--
NetSurf Browser