Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: 'git diff' no longer needs the '--no-prefix' option.

...

This page tells you how to work with Git. See HowToContribute How To Contribute for instructions on building and testing Hadoop.

...



Then generate a patch file listing the differences between your trunk and your branch

Code Block
git diff --no-prefix trunk > ../hadoop-patches/HDFS-775-1.patch

...

Code Block
diff --git src/java/org/apache/hadoop/hdfs/server/datanode/FSDataset.java src/java/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
index 42ba15e..6383239 100644
--- src/java/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
+++ src/java/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
@@ -355,12 +355,14 @@ public class FSDataset implements FSConstants, FSDatasetInterface {
       return dfsUsage.getUsed();
     }

+    /**
+     * Calculate the capacity of the filesystem, after removing any
+     * reserved capacity.
+     * @return the unreserved number of bytes left in this filesystem. May be zero.
+     */
     long getCapacity() throws IOException {
-      if (reserved > usage.getCapacity()) {
-        return 0;
-      }
-
-      return usage.getCapacity()-reserved;
+      long remaining = usage.getCapacity() - reserved;
+      return remaining > 0 ? remaining : 0;
     }

     long getAvailable() throws IOException {

...


Updating your patch

If your patch is not immediately accepted, do not be offended: it happens to us all. It introduces a problem: your branches become out of date. You need to check out the latest apache version, merge your branches with it, and then push the changes back to GitHub.

...