Re: [PATCH 1/2] ocfs2: Use b_folio in ocfs2_symlink_get_block()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 13, 2025 at 06:37:27PM +0000, Matthew Wilcox (Oracle) wrote:
>  		 * copy, the data is still good. */
> -		if (buffer_jbd(buffer_cache_bh)
> -		    && ocfs2_inode_is_new(inode)) {
> -			kaddr = kmap_atomic(bh_result->b_page);
> -			if (!kaddr) {
> -				mlog(ML_ERROR, "couldn't kmap!\n");
> -				goto bail;
> -			}
> -			memcpy(kaddr + (bh_result->b_size * iblock),
> -			       buffer_cache_bh->b_data,
> -			       bh_result->b_size);
> -			kunmap_atomic(kaddr);
> +		if (buffer_jbd(buffer_cache_bh) && ocfs2_inode_is_new(inode)) {
> +			kaddr = kmap_local_folio(bh_result->b_folio,
> +					bh_result->b_size * iblock);
> +			memcpy(kaddr, buffer_cache_bh->b_data,
> +					bh_result->b_size);
> +			kunmap_local(kaddr);
>  			set_buffer_uptodate(bh_result);

hm, now that I look at this again, I think this should actually be:

                if (buffer_jbd(buffer_cache_bh) && ocfs2_inode_is_new(inode)) {
-                       kaddr = kmap_local_folio(bh_result->b_folio,
-                                       bh_result->b_size * iblock);
-                       memcpy(kaddr, buffer_cache_bh->b_data,
+                       memcpy_to_folio(bh_result->b_folio,
+                                       bh_result->b_size * iblock,
+                                       buffer_cache_bh->b_data,
                                        bh_result->b_size);
-                       kunmap_local(kaddr);
                        set_buffer_uptodate(bh_result);

ie use the helper instead of open-coding it.  I'll send a replacement
patch.




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux