Merge tag 'stable/for-linus-3.12-rc0-tag-two' of git://git.kernel.org/pub/scm/linux...
[cascardo/linux.git] / fs / f2fs / xattr.h
index 3c0817b..02a08fb 100644 (file)
@@ -51,7 +51,7 @@ struct f2fs_xattr_entry {
 
 #define XATTR_HDR(ptr)         ((struct f2fs_xattr_header *)(ptr))
 #define XATTR_ENTRY(ptr)       ((struct f2fs_xattr_entry *)(ptr))
-#define XATTR_FIRST_ENTRY(ptr) (XATTR_ENTRY(XATTR_HDR(ptr)+1))
+#define XATTR_FIRST_ENTRY(ptr) (XATTR_ENTRY(XATTR_HDR(ptr) + 1))
 #define XATTR_ROUND            (3)
 
 #define XATTR_ALIGN(size)      ((size + XATTR_ROUND) & ~XATTR_ROUND)
@@ -69,17 +69,16 @@ struct f2fs_xattr_entry {
                                !IS_XATTR_LAST_ENTRY(entry);\
                                entry = XATTR_NEXT_ENTRY(entry))
 
+#define MIN_OFFSET(i)  XATTR_ALIGN(inline_xattr_size(i) + PAGE_SIZE -  \
+                               sizeof(struct node_footer) - sizeof(__u32))
 
-#define MIN_OFFSET     XATTR_ALIGN(PAGE_SIZE - \
-                       sizeof(struct node_footer) - \
-                       sizeof(__u32))
-
-#define MAX_VALUE_LEN  (MIN_OFFSET - sizeof(struct f2fs_xattr_header) - \
-                       sizeof(struct f2fs_xattr_entry))
+#define MAX_VALUE_LEN(i)       (MIN_OFFSET(i) -                        \
+                               sizeof(struct f2fs_xattr_header) -      \
+                               sizeof(struct f2fs_xattr_entry))
 
 /*
  * On-disk structure of f2fs_xattr
- * We use only 1 block for xattr.
+ * We use inline xattrs space + 1 block for xattr.
  *
  * +--------------------+
  * | f2fs_xattr_header  |