f2fs crypto: add encryption support in read/write paths
[deliverable/linux.git] / fs / f2fs / inline.c
index 8140e4f0e538e5ecfc0568664cd098d0ed944d57..b0b7805028365485a941c0113bdb4b28caa59b8a 100644 (file)
@@ -13,7 +13,7 @@
 
 #include "f2fs.h"
 
-bool f2fs_may_inline(struct inode *inode)
+bool f2fs_may_inline_data(struct inode *inode)
 {
        if (!test_opt(F2FS_I_SB(inode), INLINE_DATA))
                return false;
@@ -27,6 +27,20 @@ bool f2fs_may_inline(struct inode *inode)
        if (i_size_read(inode) > MAX_INLINE_DATA)
                return false;
 
+       if (f2fs_encrypted_inode(inode) && S_ISREG(inode->i_mode))
+               return false;
+
+       return true;
+}
+
+bool f2fs_may_inline_dentry(struct inode *inode)
+{
+       if (!test_opt(F2FS_I_SB(inode), INLINE_DENTRY))
+               return false;
+
+       if (!S_ISDIR(inode->i_mode))
+               return false;
+
        return true;
 }
 
@@ -95,8 +109,11 @@ int f2fs_convert_inline_page(struct dnode_of_data *dn, struct page *page)
 {
        void *src_addr, *dst_addr;
        struct f2fs_io_info fio = {
+               .sbi = F2FS_I_SB(dn->inode),
                .type = DATA,
                .rw = WRITE_SYNC | REQ_PRIO,
+               .page = page,
+               .encrypted_page = NULL,
        };
        int dirty, err;
 
@@ -130,7 +147,7 @@ no_update:
        /* write data page to try to make data consistent */
        set_page_writeback(page);
        fio.blk_addr = dn->data_blkaddr;
-       write_data_page(page, dn, &fio);
+       write_data_page(dn, &fio);
        set_data_blkaddr(dn);
        f2fs_update_extent_cache(dn);
        f2fs_wait_on_page_writeback(page, DATA);
This page took 0.032098 seconds and 5 git commands to generate.