|
|
d1681e |
From 78918cf18ead4637c5aea20025c319d845518733 Mon Sep 17 00:00:00 2001
|
|
|
d1681e |
From: moagrawa <moagrawa@redhat.com>
|
|
|
d1681e |
Date: Mon, 26 Mar 2018 11:00:22 +0530
|
|
|
d1681e |
Subject: [PATCH 201/201] posix: After set storage.reserve limit df does not
|
|
|
d1681e |
show correct output
|
|
|
d1681e |
|
|
|
d1681e |
Problem: After set storage.reserve limit df does not show correct
|
|
|
d1681e |
output on client
|
|
|
d1681e |
|
|
|
d1681e |
Solution: Update code in posix_statfs to reflect the disk usage
|
|
|
d1681e |
correctly on client
|
|
|
d1681e |
|
|
|
d1681e |
> BUG: 1533736
|
|
|
d1681e |
> Change-Id: I2c5feda0303d0f4abe5af22fac903011792b2dc8
|
|
|
d1681e |
> Reviewed on https://review.gluster.org/#/c/19186/
|
|
|
d1681e |
> Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
|
|
|
d1681e |
> (cherry pick from commit c494445c886e16ddc6a960b9074a68fe9621ee09)
|
|
|
d1681e |
|
|
|
d1681e |
BUG: 1550982
|
|
|
d1681e |
Change-Id: I5444fad40f2df2fdcf4ab80c2641fc9cc56b18fe
|
|
|
d1681e |
Signed-off-by: moagrawa <moagrawa@redhat.com>
|
|
|
d1681e |
Reviewed-on: https://code.engineering.redhat.com/gerrit/133745
|
|
|
d1681e |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
d1681e |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
d1681e |
---
|
|
|
d1681e |
xlators/storage/posix/src/posix.c | 13 ++++++++++++-
|
|
|
d1681e |
1 file changed, 12 insertions(+), 1 deletion(-)
|
|
|
d1681e |
|
|
|
d1681e |
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
|
|
|
d1681e |
index 6856e5e..56a2ca9 100644
|
|
|
d1681e |
--- a/xlators/storage/posix/src/posix.c
|
|
|
d1681e |
+++ b/xlators/storage/posix/src/posix.c
|
|
|
d1681e |
@@ -3751,6 +3751,7 @@ posix_statfs (call_frame_t *frame, xlator_t *this,
|
|
|
d1681e |
struct posix_private * priv = NULL;
|
|
|
d1681e |
int shared_by = 1;
|
|
|
d1681e |
int percent = 0;
|
|
|
d1681e |
+ uint64_t reserved_blocks = 0;
|
|
|
d1681e |
|
|
|
d1681e |
VALIDATE_OR_GOTO (frame, out);
|
|
|
d1681e |
VALIDATE_OR_GOTO (this, out);
|
|
|
d1681e |
@@ -3776,7 +3777,17 @@ posix_statfs (call_frame_t *frame, xlator_t *this,
|
|
|
d1681e |
}
|
|
|
d1681e |
|
|
|
d1681e |
percent = priv->disk_reserve;
|
|
|
d1681e |
- buf.f_bfree = (buf.f_bfree - ((buf.f_blocks * percent) / 100));
|
|
|
d1681e |
+ reserved_blocks = (buf.f_blocks * percent) / 100;
|
|
|
d1681e |
+
|
|
|
d1681e |
+ if (buf.f_bfree > reserved_blocks) {
|
|
|
d1681e |
+ buf.f_bfree = (buf.f_bfree - reserved_blocks);
|
|
|
d1681e |
+ if (buf.f_bavail > buf.f_bfree) {
|
|
|
d1681e |
+ buf.f_bavail = buf.f_bfree;
|
|
|
d1681e |
+ }
|
|
|
d1681e |
+ } else {
|
|
|
d1681e |
+ buf.f_bfree = 0;
|
|
|
d1681e |
+ buf.f_bavail = 0;
|
|
|
d1681e |
+ }
|
|
|
d1681e |
|
|
|
d1681e |
shared_by = priv->shared_brick_count;
|
|
|
d1681e |
if (shared_by > 1) {
|
|
|
d1681e |
--
|
|
|
d1681e |
1.8.3.1
|
|
|
d1681e |
|